Bulk search for metadata

Started by Duzeper, May 06, 2025, 07:15:30 PM

Previous topic - Next topic

Duzeper

Is it possible to search all files in a folder for IPTC caption data and output the result to a file?

Phil Harvey

Yes.

What do you mean by "result"?  The file names?  If so, then here is a possibility:

exiftool -filename -if "$iptc:caption-abstract eq 'SOME TEXT'" -filename -s3 -q DIR > out.txt

Also assuming you mean the IPTC IIM Caption-abstract tag.

- 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 ($).

Duzeper

Thanks
Yes, file names is what I want. However, I am not looking for specific text, more, what text is in each file (including, probably most importantly, no text), so, a list of file names alongside the caption text.

Also, yes I assume IPTC IIM Caption-abstract tag, although, the software I am using (XnView MP) simply lists Caption (and Local Caption, which I am not using) under the IPTC-IIM tab.

I should point out (as is probably clear) that I am not fully 'au fait' with the ins and outs of metadata.

Martin

StarGeek

Quote from: Duzeper on May 07, 2025, 06:08:14 AMYes, file names is what I want. However, I am not looking for specific text, more, what text is in each file (including, probably most importantly, no text), so, a list of file names alongside the caption text.

It takes a slight change to Phil's command to do this.
exiftool -filename -if "$iptc:caption-abstract" -filename -s3 -q DIR > out.txt

You forgot to mention your OS. This command would be for Windows CMD. If you're on Mac/Linux, change the double quotes into single quotes.

QuoteI should point out (as is probably clear) that I am not fully 'au fait' with the ins and outs of metadata.

The command in FAQ #3 should be your base command. It will show tag names, not descriptions, duplicate tags and the groups they belong too.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Duzeper

#4
Firstly, yes I am using Windows 10
OK, I am not sure about the syntax involving file paths/text containing spaces, but I have tried this:
exiftool -filename -if "$iptc:caption-abstract" -filename -s3 -q 'I:\Duplicates\Buildings L' > I:\out.txt
which half works, in that it produces an accurate list of file names, however they are all duplicated and there is no caption text.

I have just tried:
exiftool -filename -if "$iptc:caption" -filename -s3 -q 'I:\Duplicates\Buildings L' > I:\out.txt
and, although that produces a single list of file names, there is still no caption text.

To clarify, I am looking to produce a list of file names together with the caption data they contain.

Martin

StarGeek

Add
-Caption-Abstract
after -Filename, with a space separating each side.

Make sure you're using CMD, not Powershell. Powershell's quoting rules are different and if you want to use that, you'll have to figure out the quotes and special characters.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Duzeper

Thanks for your help. The following does what I wanted (in CMD):
exiftool -T -filename -Caption-Abstract -if $iptc:caption-abstract -s3 -q "I:\Duplicates\Buildings L" > I:\out.txt
I removed the second instance of -filename as that resulted in another file name line in the output and  -T to output to a tab-delimited file.

Thanks again for your help. I needed your input to get me started.

Martin


Duzeper

Sorry, me again.
What is the syntax to include file names where the caption field is blank?
The command I used ignores these files, but I would like them included.

Martin

StarGeek

Do you want all files? Or just files that have a Caption-Abstract.

Removing the -if option will show all files
exiftool -T -filename -Caption-Abstract -s3 -q "I:\Duplicates\Buildings L" > I:\out.txt

To show files without a Caption-Abstract
exiftool -T -filename -Caption-Abstract -if "not $iptc:caption-abstract" -s3 -q "I:\Duplicates\Buildings L" > I:\out.txt
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Duzeper

Thanks again.
The 'all files' option did the trick

Martin