Output files with no keywords using IF and CSV

Started by ericconn, November 22, 2013, 12:28:58 PM

Previous topic - Next topic

ericconn

Is there a way to write to CSV with the condition of empty fields, in my case keywords? I tested this on a folder, and had no results with exiftool -if '$keywords=//' -filename -r -csv "C:\test" > "C:\test.csv". I wasn't sure what you put between the //'s.

Thanks.

Phil Harvey

Testing for an empty keyword is a bit tricky, but this should do it:

-if "$keywords=~/(^|, )(, |$)/"

This expression looks for ", , " anywhere in the Keywords string, or ", " at the start or end, or an empty string.

Note that you must use double quotes in Windows.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ericconn