fix check for mepty filename
This commit is contained in:
parent
af0721c7a1
commit
5fc0c8e91c
1 changed files with 4 additions and 4 deletions
|
@ -3,10 +3,12 @@ while read -r dir
|
||||||
do
|
do
|
||||||
echo "Checking dir '${dir}'..."
|
echo "Checking dir '${dir}'..."
|
||||||
last_file="${dir}/$(ls -ht -- "${dir}/" | grep \.webm\.download_info\.json | head -n1)"
|
last_file="${dir}/$(ls -ht -- "${dir}/" | grep \.webm\.download_info\.json | head -n1)"
|
||||||
if [ -z "${last_file}" ]; then
|
if [ "${last_file}" == "${dir}/" ]; then
|
||||||
last_file="${dir}/$(ls -ht -- "${dir}/" | head -n1)"
|
last_file="${dir}/$(ls -ht -- "${dir}/" | head -n1)"
|
||||||
fi
|
fi
|
||||||
if [ -n "${last_file}" ]; then
|
if [ "${last_file}" == "${dir}/" ]; then
|
||||||
|
echo "Skipping, no file found in dir"
|
||||||
|
else
|
||||||
echo "Last modified file is '${last_file}'"
|
echo "Last modified file is '${last_file}'"
|
||||||
filetime="$(jq '.info_dict.filetime' -- "${last_file}" )"
|
filetime="$(jq '.info_dict.filetime' -- "${last_file}" )"
|
||||||
if [ "${filetime}" != "null" ] && [ -n "${filetime}" ]; then
|
if [ "${filetime}" != "null" ] && [ -n "${filetime}" ]; then
|
||||||
|
@ -15,7 +17,5 @@ do
|
||||||
else
|
else
|
||||||
touch -r "${last_file}" -- "${dir}"
|
touch -r "${last_file}" -- "${dir}"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "Skipping, no file found in dir"
|
|
||||||
fi
|
fi
|
||||||
done <<< "$(find . -mindepth 1 -maxdepth 1 -type d)"
|
done <<< "$(find . -mindepth 1 -maxdepth 1 -type d)"
|
||||||
|
|
Loading…
Reference in a new issue