Hi there :)
All my files are arranged by folders in years eg: 'photos/2010'.
I would like to run a script which does the following.
1. If `$exif:datetimeoriginal` does NOT exist , add date based on the parent folder (1st Jan)
`exiftool -r -if 'not $exif:datetimeoriginal' -AllDates='[PARENT_NAME_FOLDER_FOR_YEAR]:01:01 00:00:00' -overwrite_original`
3. Set modify/create dates `exiftool -r "-FileModifyDate<EXIF:DateTimeOriginal" "-FileCreateDate<EXIF:DateTimeOriginal"`
Can you assist? Thanks
Do any folders above the parent have any 4 digit numbers in the name? If not, then this will work:
exiftool -r -if 'not $exif:datetimeoriginal' '-AllDates<${directory}:01:01 00:00:00' -overwrite_original -ext jpg DIR
I have also added -ext jpg to avoid surprises in case there are other file types in the folder. You can add more -ext options to process other types in the same command.
Then run your 2nd command to change all of the filesystem dates to DateTimeOriginal.
- Phil
Quote from: Phil Harvey on February 04, 2022, 09:50:04 PM
Do any folders above the parent have any 4 digit numbers in the name? If not, then this will work:
Thanks. All folders have 4 digit numbers as their name (eg "2010") and no children folders inside of them. Is are you saying that won't work?
I'm saying that as long as the year is the only 4-digit number, this should work.
- Phil