Find images with No Exif Dates
Posted on 2014-08-01
My Dropbox folder is full of images claiming to be "missing dates." 1 Some of these photos were thumbnails or images from DayOne that didn't necessarily need dates, but others were real photos that for whatever reason didn't have dates that Dropbox recognized.
I did some poking around, and found that there were a couple of different reasons why my photos in Dropbox weren't displaying dates:
- The DateTimeOriginal exif tag was missing entirely
- The DateTimeOriginal was set to 0000:00:00 00:00:00
With the magic of exiftool, I found a way to find all the photos in my Dropbox folder that were missing dates and output the results to a CSV.
exiftool -filename -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' -common -csv > ~/Dropbox/nodates.csv
This will give you a CSV with all of the common file information for the images.
At this point, you'll need to decide how you'll want to fix these photos. From what I have seen so far, the best exif tag to go on is
-filemodifydate, but you'll probably need to figure that out on your own. If you want to fix any photo that matches the above criteria, you can do something like this
exiftool `-datetimeoriginal<filemodifydate` -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' ~/Dropbox
2965 photos to be exact. ↩
Tags: bash automation exiftool photos