use filetime from json

This commit is contained in:
Antonio J. Delgado 2024-11-20 12:45:46 +02:00
parent b83dab901e
commit 4bad82cdd9

View file

@ -2,7 +2,11 @@
while read -r dir
do
echo "Checking dir '${dir}'..."
last_file="${dir}/$(ls -ht -- "${dir}" | head -n1)"
last_file="${dir}/$(ls -ht -- "${dir}/" | grep \.webm\.download_info\.json | head -n1)"
echo "Last modified file is '${last_file}'"
touch -r "${last_file}" -- "${dir}"
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}"
fi
done <<< "$(find . -mindepth 1 -maxdepth 1 -type d)"