changing the exif date to match the file name

Started by 30624700, March 14, 2021, 04:28:30 PM

Previous topic - Next topic

30624700

I have a bunch of photos with file names "20180207-01" "YYYYMMDD-xx" with x being a random number. I have messed up the created and modified date and they are no longer the original date and time when the pictures are taken.  Is there a way to change the date created and date modified same as the file name.

I have been researching and found a similar thread but the methods inside doesnt really solve my problem https://exiftool.org/forum/index.php?topic=7384.0

Thank you very much for your help

I have attached a screenshot of the photos to give a better understanding of a situation, thank you again

StarGeek

Try
exiftool "-FileCreateDate<${Filename;s/-.*//} 00:00:00" "-FileModifyDate<${Filename;s/-.*//} 00:00:00" /path/to/files/

This will strip anything after the dash - and use what's left as the date.  The time is then set to midnight.  This command assumes you're using Windows CMD.  Swap the double quotes for single quotes if on Mac/Linux.

Also, this will only work on the format you posted.  If run on files that have a dash in a different place, you will get unexpected results.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).