utorok 4. apríla 2023

Set file modification time based on file name (or EXIF data)

This snippet works for the Iphone image/movie files in format: YY-MM-DD HH24-MI-SS NNNN.ext


for f in *mov; do
  echo $f
  touch "$f" -t "20${f:0:2}${f:3:2}${f:6:2}${f:9:2}${f:12:2}.${f:15:2}"
done


Then, to overwrite with EXIF information from JPEG files:

exiv2 -T rename *.jpg


Useful snippet for some of the Iphone files/movies on my disk:

find . -type f -name \*720p.mov | while read LINE; do
  f=$(basename "$LINE")
  echo "$LINE"
  touch "$LINE" -t "20${f:0:2}${f:3:2}${f:6:2}${f:9:2}${f:12:2}.${f:15:2}"
done

Žiadne komentáre:

Zverejnenie komentára