Thread

Posted on Wed Dec 19 09:30:19 2007 by bv
using -if with DateTimeOriginal to test for Null Data

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 : : : : :
Direct Responses: 6724 | Write a response
Posted on Wed Dec 19 14:10:52 2007 by exiftool in response to 6723
Re: using -if with DateTimeOriginal to test for Null Data
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
Direct Responses: 6725 | Write a response
Posted on Wed Dec 19 14:14:41 2007 by exiftool in response to 6724
Re: using -if with DateTimeOriginal to test for Null Data
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
Direct Responses: 6727 | Write a response
Posted on Wed Dec 19 18:40:38 2007 by bv in response to 6725
Re: using -if with DateTimeOriginal to test for Null Data

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
Direct Responses: 6728 | Write a response
Posted on Wed Dec 19 18:48:58 2007 by bv in response to 6727
Re: using -if with DateTimeOriginal to test for Null Data

My mistake leaving an unwanted space in there. Here is the working argfile:


-P -DateTimeOriginal<FileModifyDate -if not $dateTimeOriginal or $dateTimeOriginal !~ /^[12]/
Write a response