ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: ericconn on November 22, 2013, 12:28:58 PM

Title: Output files with no keywords using IF and CSV
Post by: ericconn on November 22, 2013, 12:28:58 PM
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.
Title: Re: Output files with no keywords using IF and CSV
Post by: Phil Harvey on November 22, 2013, 12:34:01 PM
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
Title: Re: Output files with no keywords using IF and CSV
Post by: ericconn on November 22, 2013, 01:28:46 PM
Excellent. That worked. Thanks a lot.