[Originally posted by bv on 2007-12-19 07:30:19-08]Hi Phil,
How do I write the ArgFile code to test if a date is NULL? I have had no success and I have tried every combination of possibilities. I even tried to use $Year (from Exitfool_config from before).
-Brooks
-P
-DateTimeOriginal<FileModifyDate
-if
$DateTimeOriginal eq " : : : :"
# NOT $DateTimeOriginal
# $DateTimeOriginal eq ""
# $DateTimeOriginal eq 0
# $DateTimeOriginal eq "0000"
Sample output
F:\Photos\2005\2005_01_01>EXIFTOOL -ALLDATES *.jpg
======== IMG_0117.JPG
Date/Time Original : : : : :
Create Date : : : : :
Modify Date : : : : :
[Originally posted by exiftool on 2007-12-19 12:10:52-08]Hi Brooks,
I'm not sure what you mean by NULL. Is the date an empty string,
or all zeros, or missing entirely? How about this: Set the date/time
only if it doesn't begin with a 1 or a 2:
-if "$dateTimeOriginal !~ /^[12]/"
- Phil
[Originally posted by exiftool on 2007-12-19 12:14:41-08]Oh. But that didn't handle the case that the date/time is missing.
Try this instead:
-if "not $dateTimeOriginal or $dateTimeOriginal !~ /^[12]/"
(you were close with "NOT $dateTimeOriginal", but the logical operators
are all lower case in Perl.)
- Phil
[Originally posted by bv on 2007-12-19 16:40:38-08]Hi Phil, I am not sure what I am doing wrong when trying to use @argile syntax. This is what I get.
#ArgFile DateTest.arg
-DateTimeOriginal<FileModifyDate
-if
not $dateTimeOriginal or $date TimeOriginal !~ /^[12]/
# End of ArgFile DateTest.arg
Results
F:\Photos\2005\2005_01_01>exiftool -v -@ bv_UseModDate.arg IMG_0118.JPG
Condition: syntax error - ~/^[12]/
-------- ~/^[12]/ (failed condition)
Condition: syntax error - IMG_0118.JPG
-------- IMG_0118.JPG (failed condition)
2 files failed condition
[Originally posted by bv on 2007-12-19 16:48:58-08]My mistake leaving an unwanted space in there. Here is the working argfile:
-P
-DateTimeOriginal<FileModifyDate
-if
not $dateTimeOriginal or $dateTimeOriginal !~ /^[12]/