Google photos gets messed up when DateTimeOriginal is not present. It will look to FileModifyDate (I think), which if I made changes to it via Lightroom or Photoshop, it will have the incorrect date, thus my google photos sort is off. I'm using a Mac.
I've been able to export to a file based on a post I saw from here:
exiftool -csv -r -DateTimeOriginal -FileModifyDate -ModifyDate -CreateDate -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . > picsmissingdate.csv
But now I want to move these files, without changing its name, to another directory. I've tried 2 things but both fail:
exiftool -if '(not $datetimeoriginal) and $filetype eq "JPEG"' . -d -r /Users/MYNAME/Pictures/MoveTestOutput
doesn't move files and I get a huge output in terminal
AND
exiftool -if '$datetimeoriginal' -dummy $1 /Users/MYNAME/Pictures/MoveTestOutput
which just hangs.
Sorry for the beginner questions!
Thanks.
There's an extraneous -d in your command and you're not telling exiftool to move the files either ;D
Use
exiftool '-directory=/Users/MYNAME/Pictures/MoveTestOutput' -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .
instead (switch double and single quotes when running this under windows).
Instead of testing for JPGs with $filetype eq "JPEG" you could also use -ext JPG which is likely somewhat faster:
exiftool '-directory=/Users/MYNAME/Pictures/MoveTestOutput' -r -if 'not $datetimeoriginal' -ext JPG .
Thanks very helpful! They both worked great, but since iPhone moved to HEIC files, the filetype=jpeg works but I don't think the -ext jpg will. I've changed my setting in iPhone back to jpeg so it should work fine (annoyed that Apple made the change without communicating)... Interestingly, the picture files that seem to not hold the DateTimeOriginal are the ones texted to me. Even more reason to tell friends to email pictures or put them up on a server.
One other question, if you don't mind me asking. I have the same issue for videos. It's the "Creation Date" that often is there but sometimes not. I'd like to do either 1 of 2 things:
#1) move mov files that are missing the CreationDate to another folder, then update all date tags with the Creation date. Can I combine the 2 statements below into one?
exiftool '-directory=/Users/MYNAME/Pictures/MovNoCreationDate' -r -if '(not $CreationDate)' -ext .MOV .
exiftool '-TrackCreateDate<CreationDate' '-CreateDate<CreationDate' '-ModifyDate<CreationDate' '-TrackModifyDate<CreationDate' '-MediaCreateDate<CreationDate' '-MediaModifyDate<CreationDate' -P -r . -ext .MOV -overwrite_original
#2 not move the files but if the creation date is missing, use the FileModifyDate, which often is correct if the file has not been altered, to update all date tags. I'm not sure if I can do an else statement
THANKS!
To include both JPG and the new HEIC format simply run:
exiftool '-directory=/Users/MYNAME/Pictures/MoveTestOutput' -if 'not $datetimeoriginal' -r -ext JPG -ext HEIC .
Note: if you don't want to take pictures in the new format, go to Settings|Camera|Formats and choose "Most Compatible". This will disable some (video) features, but you will then shoot normal JPG and MOV. Whether or not you should do so depends on how you intend to use your pictures/videos as well as the editing software you have.
There's no "else" but with some trickery you can run exiftool twice on the same files in one statement, but with different arguments.
So #1 could be done like this:
exiftool '-directory=/Users/MYNAME/Pictures/MovNoCreationDate' -r -if 'not $CreationDate' -execute '-TrackCreateDate<CreationDate' '-CreateDate<CreationDate' '-ModifyDate<CreationDate' '-TrackModifyDate<CreationDate' '-MediaCreateDate<CreationDate' '-MediaModifyDate<CreationDate' -P -overwrite_original -if '$CreationDate' -common_args -r -ext MOV .
The trick is the use of -execute to run exiftool again with another set of parameters, -common_args is used to setup the parameters common to both executions.
#2 could be done like this:
exiftool '-TrackCreateDate<FileModifyDate' '-TrackCreateDate<CreationDate' '-CreateDate<FileModifyDate' '-CreateDate<CreationDate' '-ModifyDate<FileModifyDate' '-ModifyDate<CreationDate' '-TrackModifyDate<FileModifyDate' '-TrackModifyDate<CreationDate' '-MediaCreateDate<FileModifyDate' '-MediaCreateDate<CreationDate' '-MediaModifyDate<FileModifyDate' '-MediaModifyDate<CreationDate' -P -overwrite_original -r -ext MOV .
This works because the second setting of the tag will override the first, but only if the second source tag indeed exists.
Super Helpful! Worked like a charm for mov files!
I tried to take what you wrote for mov's and apply to images. I'm having issues updating HEIF files. Here's my statement:
exiftool '-directory=/Users/MYNAME/Pictures/WIP/PicsNoOrDate' -r -if 'not $datetimeoriginal' -execute '-CreateDate<DateTimeOriginal' '-ModifyDate<DateTimeOriginal' -P -overwrite_original -if '$DateTimeOriginal' -common_args -r -ext JPG -ext HEIC .
It succeeds in moving the missing datetimeoriginal files to the folder. It succeeds in updating the JPEG files. It does not work for any HEIC file, and I get a couple errors:
Error: Can't currently write HEIC/HEIF files - ./IMG_1855.HEIC
Error: Not a valid MOV (looks more like a JPEG) - ./IMG_1678.HEIC
I tried just updating the HEIC files without the double statement above:
exiftool '-CreateDate<DateTimeOriginal' '-ModifyDate<DateTimeOriginal' -P -r -overwrite_original -ext HEIC .
Same error. Not sure why it would be interpreting HEIC files as movie files.
Last, I don't really understand what's happening in the "-if '$DateTimeOriginal' -common_args" part of the statement. If Datetimeoriginal is what? exists, not blank? I suspect I have an issues with -common_args because you state that it's used to setup the parameters common to both executions.
Thank you much.
-MARQY
HEIC is based on the MOV (QuickTime) format. I will see about improving this warning message.
And yes, ExifTool can not currently write HEIC files.
About the common_args... This command:
exiftool '-directory=/Users/MYNAME/Pictures/WIP/PicsNoOrDate' -r -if 'not $datetimeoriginal' -execute '-CreateDate<DateTimeOriginal' '-ModifyDate<DateTimeOriginal' -P -overwrite_original -if '$DateTimeOriginal' -common_args -r -ext JPG -ext HEIC .
is then equivalent to these two commands:
exiftool '-directory=/Users/MYNAME/Pictures/WIP/PicsNoOrDate' -r -if 'not $datetimeoriginal' -r -ext JPG -ext HEIC .
exiftool '-CreateDate<DateTimeOriginal' '-ModifyDate<DateTimeOriginal' -P -overwrite_original -if '$DateTimeOriginal' -r -ext JPG -ext HEIC .
Everything after -common_args applies to both commands.
- Phil
Ok thank you! exiftool is very helpful and by far the best thing out there!