ExifTool Forum

ExifTool => Newbies => Topic started by: mdrl on August 08, 2018, 07:45:55 AM

Title: Update Date from FileName
Post by: mdrl on August 08, 2018, 07:45:55 AM
Hello,

Thanks for this very good tool.
I have a problem with all my pictures >5000 pictures. They have been exported since months from LR with the option to delete all metadata by error. :-\
Hopefully my files have been named with the exact date.

I would like to update the Tag "DateTimeOriginal" from my files named as YYYY-MM-DD-HHh-MMm-SSs.jpg  (like 2017-07-02-17h05m53s.jpg).

I tried to understand your documentation but I tried to have reach my limit of my skills.

I need to extract from the name the year, month, day etc..
I suppose I need to play with the %Xf and %X-f
%4f%-12 for the month 07 in 2017-07-02-17h05m53s.jpg

I have tried things like :
exiftool "-FileModifyDate=2017:%4f%-12:%4f%-12 17:05:53 ยป 2017-07-02-17h05m53s.jpg

Could you please tell me if it is possible to find a way ?
Thanks


Title: Re: Update Date from FileName
Post by: Phil Harvey on August 08, 2018, 07:58:24 AM
Try this command:

exiftool "-alldates<filename" DIR

This will set the EXIF DateTimeOriginal, CreateDate and ModifyDate from the file name.  If you also want to set the filesystem modification date/time, add "-filemodifydate<filename" to the command.

- Phil
Title: Re: Update Date from FileName
Post by: mdrl on August 08, 2018, 08:18:25 AM
Whaou. Thanks a lot.
It was so easy. :-[ I have spend like more than 4 hours to read and make some tests.
The good thing I have learn a lot reading your documentation. Thanks for the solution !