[Originally posted by dschless on 2010-02-15 05:47:54.634783-08]
When a file's EXIF Date/Time Original contains a partial date, e.g. 2009:01 - year and month but no day, there is an inconsistency when extracting the date field:
exiftool -DateTimeOriginal file.jpg
Date/Time Original : 2005:01: 00:00:00
exiftool -exif:DateTimeOriginal -d "y=%Y m=%m d=%d" file.jpg
Date/Time Original : y=2004 m=12 d=31
I understand why it is happening, but the formatted date has the wrong value. Also if %d is returning the last day of the previous month instead of blank or nothing, is there any way to list files that are missing the day value using an -IF EXPR?
Thanks,
Dan Schless
[Originally posted by exiftool on 2010-02-15 08:51:34.833446-08]
Hi Dan,
You could try -if "$datetimeoriginal =~ /: /" to find dates
with a missing value. Also, it is possible that the StrictDate
option may help avoid invalid values as it adds a bit more
checking on the date/time format. This option may only
be enabled via the config file.
- Phil
[Originally posted by dschless on 2010-02-15 10:10:36.512425-08]Phil,
Thanks for the suggestion. After playing around, it seems that this might be a better, more generic solution
exiftool -exif:DateTimeOriginal -if "not $datetimeoriginal =~ /\d{4}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}/" *.jpg
Dan Schless