Image-ExifTool - Re: Help Using Conditional Logic Please

Posted on Mon Jul 14 14:33:27 2008 by exiftool in response to 8294 (See the whole thread of 8)
Re: Help Using Conditional Logic Please
Hi Justin,

What you have done will work, except the Perl string comparison operators are "eq", "lt", "le", "gt" and "ge". The "=", "lt;", "lt;=", "gt;" and "gt;=" are numerical comparison operators. So your -if statement should be:

- if "$model eq 'NIKON D200' and $createdate ge '2008:03:30' and $createdate le '2008:06:10'"

Note that in general you have to be careful using "eq" to test Model strings because sometimes you get trailing spaces in the model name. But in this case, the D200 doesn't have this problem. However, the way around this for other cameras is to use a regular expression to look for a substring:

-if "$model =~ /NIKON D200/"

- Phil
Direct Responses: 8298 | Write a response