Field condition testing (for space or null value).

Started by Archive, May 12, 2010, 08:54:01 AM

Previous topic - Next topic

Archive

[Originally posted by nickmills on 2007-03-18 14:12:39-07]

Hi Phil,

I am trying identify files which do not contain data in the field "Caption-Abstract" and generate reports of these items.
These images reside in .nef files which have been generated by a Nikon Coolscan which describes the field as "Caption" ("Description" in Adobe Photoshop).

I have tried various permutations of condition testing with the "-if" argument such as:

-if `$caption-abstract contains " "
I know that the Caption-Abstract field contains spaces for at least some of these files but, as you can see, all images are rejected.

Maybe I am missing something obvious as I know nothing of Perl, maybe there is a Dos command line restriction.

Anyway advice would be gratefully received.

Nick. 2007_03_18, Sun 13:22

P.S. Is there any way of outputting all the data (from multiple files) to one report file?

Archive

[Originally posted by exiftool on 2007-03-18 14:39:49-07]

Hi Nick,

The Perl syntax to test for the existence of a character string
(in this case a space) within a tag is:

Code:
-if "$caption-abstract =~ / /"

but it sounds like this isn't what you want to do.  If you want
to just print the names of all files which don't contain a
caption-abstract, you can do this:

Code:
exiftool -if "not $caption-abstract" -filename -t -S -q DIR > list.txt

(where DIR is the name of the directory containing the images)

- Phil

Archive

[Originally posted by nickmills on 2007-03-20 10:06:42-07]

Phil, Thanks very much for that. I now understand that a Tag only comes into existance when a value is applied to it (Doh!), in this case by using NikonCapture. So your second suggestion : -if "not $caption-abstract" does the job.
Brilliant.
Thanks Nick.
20070320