I found a couple other threads addressing this - but my situation seems to not be addressed by any of them.
I have thousands of files that do not have datetimeoriginal, createdate, or modifydate set - They do however have filemodifydate
Is there a way to ONLY set files that do NOT have the above set? I realize I can set all of them from filemodifydate by using exiftool -alldates<filemodifydate but I only want to execute that IF the 3 above don't exist and I can't seem to figure how to check for a non existent tag.
What I don't want to do is start a recursive replacement of alldates with filemodifydate and end up resetting ones that I've already fixed by hand like this one for example.
Date/Time Original : 2010:02:07 21:35:36
Create Date : 2010:02:07 21:35:36
Modify Date : 2010:02:07 21:35:36
File Modification Date/Time : 2016:11:26 17:28:28-06:00
obviously the filemodifydate has changed since I updated the exif data
Thanks - Zach
As I understand it, if you write to a date tag that doesn't already exist in the metadata, it will be created and populated.IIRC
- Paul
You can do it like this:
exiftool "-datetimeoriginal<filemodifydate" -if "not $datetimeoriginal" DIR
This will copy FileModifyDate to (for example) DateTimeOriginal if it doesn't already exist.
- Phil
Is there a way to "test" this - I was trying to use -echo hello with -if but it seems to echo hello no matter if the IF condition is met.
Quote from: zmw on November 28, 2016, 12:45:04 PM
Is there a way to "test" this - I was trying to use -echo hello with -if but it seems to echo hello no matter if the IF condition is met.
exiftool -filename -if 'not $datetimeoriginal' .
======== ./pixel.jpg
File Name : pixel.jpg
======== ./temp.jpg
File Name : temp.jpg
1 directories scanned
52 files failed condition
2 image files read
You'll probably need " rather than ' under Microsoft windows.
Next test would be to copy a few files to a new directory and run the re-dating command on that directory.