option if no time or no file
This commit is contained in:
parent
4bad82cdd9
commit
f511f165ed
1 changed files with 14 additions and 5 deletions
|
@ -3,10 +3,19 @@ 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)"
|
||||||
echo "Last modified file is '${last_file}'"
|
if [ -z "${last_file}" ]; then
|
||||||
filetime="$(jq '.info_dict.filetime' -- "${last_file}" )"
|
last_file="${dir}/$(ls -ht -- "${dir}/" | head -n1)"
|
||||||
if [ "${filetime}" != "null" ]; then
|
fi
|
||||||
last_file_time_formated=$(date -d "@${filetime}" +%Y%m%d%H%M.%S)
|
if [ -n "${last_file}" ]; then
|
||||||
touch -t "${last_file_time_formated}" -- "${dir}"
|
echo "Last modified file is '${last_file}'"
|
||||||
|
filetime="$(jq '.info_dict.filetime' -- "${last_file}" )"
|
||||||
|
if [ "${filetime}" != "null" ]; then
|
||||||
|
last_file_time_formated=$(date -d "@${filetime}" +%Y%m%d%H%M.%S)
|
||||||
|
touch -t "${last_file_time_formated}" -- "${dir}"
|
||||||
|
else
|
||||||
|
touch -r "${last_file}" -- "${dir}"
|
||||||
|
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