Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting file modification date from exif date

To set the file modification date of images to the exif date, I tried the following: exiftool '-FileModifyDate<DateTimeOriginal' image.jpg But this gives me an error about SetFileTime. So maybe exiftool cannot do it in linux.

Can I combine exiftool -m -p '$FileName - $DateTimeOriginal' -if '$DateTimeOriginal' -DateTimeOriginal -s -S -ext jpg . with "touch --date ..."?


1 Answers

See this Exiftool Forum post.

The command used there is (take note of the use of backticks, not single quotes):

touch -t `exiftool -s -s -s -d "%Y%m%d%H%M.%S" -DateTimeOriginal TEST.JPG` TEST.JPG  

But I'm curious about your error. Exiftool should be able to set the FileModifyDate on Linux (though FileCreateDate is a different story). What version of Exiftool are you using (exiftool -ver to check)?

Another possibility is that the DateTimeOriginal tag is malformed or doesn't have the full date/time info in it.

like image 67
StarGeek Avatar answered Dec 16 '25 07:12

StarGeek