Update Modification Time According to EXIF Data


Find photo/video and update modification time (mtime) of the photo/video according to EXIF data.


Install exiftool:

$ sudo apt-get install libimage-exiftool-perl

Find photo/video. The -i in -iregex means case insensitive.

$ find . -type f -iregex '.*\.\(jpg\|gif\|png\|jpeg\|mov\|mp4\|heic\)$'

Update modification time according to EXIF data.

$ find . -type f -iregex '.*\.\(jpg\|gif\|png\|jpeg\|mov\|mp4\|heic\)$' | xargs -I {} exiftool "-DateTimeOriginal>FileModifyDate" {}

Instead of exiftool, you can also use jhead to update mtime.

$ sudo apt-get install jhead

Use jhead along with find command:

$ find . -type f -iregex '.*\.\(jpg\|gif\|png\|jpeg\|mov\|mp4\|heic\)$' -exec jhead -ft {} +


[1]images - Change file created date from JPEG EXIF metadata - Unix & Linux Stack Exchange
[2]regular expression - How to use find command to search for multiple extensions - Unix & Linux Stack Exchange
[3]Is there a free program to (batch) change photo file's date to match EXIF? - Photography Stack Exchange
[4]timestamp - How can I change the date modified/created of a file? - Ask Ubuntu