Use find to find last file
This commit is contained in:
parent
9e80fe7fb4
commit
f71dac44dd
1 changed files with 4 additions and 4 deletions
|
@ -3,11 +3,11 @@ while read -r dir
|
|||
do
|
||||
if [ -n "${dir}" ]; then
|
||||
echo "Checking dir '${dir}'..."
|
||||
last_file="${dir}/$(ls -ht -- "${dir}/" | grep \.webm\.download_info\.json | head -n1)"
|
||||
if [ "${last_file}" == "${dir}/" ]; then
|
||||
last_file="${dir}/$(ls -ht -- "${dir}/" | head -n1)"
|
||||
last_file="$(find "${dir}/" -type f -printf "%T@ %p\n" | sort -n | grep \.webm\.download_info\.json | head -n1 | sed 's/^[0-9\.]* //')"
|
||||
if [ "${last_file}" == "${dir}/" ] || [ -z "${last_file}" ]; then
|
||||
last_file="$(find "${dir}/" -type f -printf "%T@ %p\n" | sort -n | head -n1 | sed 's/^[0-9\.]* //')"
|
||||
fi
|
||||
if [ "${last_file}" == "${dir}/" ]; then
|
||||
if [ "${last_file}" == "${dir}/" ] || [ -z "${last_file}" ]; then
|
||||
echo "Skipping, no file found in dir"
|
||||
else
|
||||
echo "Last modified file is '${last_file}'"
|
||||
|
|
Loading…
Reference in a new issue