Can I use ExifTool to search for files with given tag value?

Started by Joanna Carter, August 20, 2021, 09:02:38 AM

Previous topic - Next topic

Joanna Carter

Normally, macOS provides indexed metadata access to things like dc:subject and dc:description and I can use Spotlight search to, extremely rapidly, return lists of files that match all sorts of criteria.

But the one thing it doesn't give search access to is the rating tag.

Enumerating through the files checking the extended attributes doesn't always bring back files that match what might be in the rating tag and I was wondering if it were possible to scan a directory to return a list of URLs of files that match a specified rating?

StarGeek

Something like this?

exiftool -if '$Rating == 3' -FilePath /path/to/files/
or
exiftool -if '$Rating>3 and $Rating<5' -FilePath /path/to/files/
"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

Joanna Carter

Thank you Star Geek. I'll put that in the memory bank.

This time,I finally found out how to correctly add ratings to the macOS Spotlight metadata on a file and that means I can now search for rated files, both in my app and using Spotlight from Finder