ExifTool Forum

ExifTool => Newbies => Topic started by: duns on May 29, 2021, 09:41:50 AM

Title: search for images with a given xmp metatag
Post by: duns on May 29, 2021, 09:41:50 AM
What is the correct syntax to search, from terminal, all the images in a folder that have a given metatag (for example the word "Giotto" in "caption" xmp metag)?
I'm not asking for show all the metatags of one image, ma to show all the names of images with a certain metag.
Thank you!
Title: Re: search for images with a given xmp metatag
Post by: StarGeek on May 29, 2021, 11:45:13 AM
Exiftool doesn't have the ability to display only tags with a certain value.

You can use the -if option (https://exiftool.org/exiftool_pod.html#if-NUM-EXPR) to check specific tags or groups of tags to see if they have a value and list specific tags or groups of tags by group name or with a wildcard.  But all tags listed will be displayed.

If you want to pull only certain tags will certain values, you will need to parse the output with a script or something similar.
Title: Re: search for images with a given xmp metatag
Post by: Phil Harvey on May 29, 2021, 05:42:03 PM
Quote from: duns on May 29, 2021, 09:41:50 AM
What is the correct syntax to search, from terminal, all the images in a folder that have a given metatag (for example the word "Giotto" in "caption" xmp metag)?

exiftool -if "$xmp:caption =~ /Giotto/" ... DIR

The ... is where you put whatever you want to do (eg. -filename to show the names of matching files).

- Phil
Title: Re: search for images with a given xmp metatag
Post by: StarGeek on May 29, 2021, 05:54:36 PM
I believe I might have misread this then.  I thought the question was to show all tags that contain a search term without specifying the tags to search.