Set JPG file timestamp from EXIF with imagemagick

One-liner to update file timestamp from EXIF for all files in a directory. I had to fix a bunch of pictures after copying them with Ubuntu file manager application which updates the ‘modified’ timestamp to current date/time on copy.

for i in *.JPG; do touch -t `identify -format "%[EXIF:DateTime]" $i | perl -n -e 'chomp; s/^(\d+):(\d+):(\d+) (\d+):(\d+):(\d+)$/$1$2$3$4$5.$6/ && print` $i; done

This entry was posted in Computers. Bookmark the permalink.

Leave a Reply