ExifTool Forum

ExifTool => Developers => Topic started by: Joanna Carter on August 20, 2021, 09:02:38 AM

Title: Can I use ExifTool to search for files with given tag value?
Post by: Joanna Carter on August 20, 2021, 09:02:38 AM
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?
Title: Re: Can I use ExifTool to search for files with given tag value?
Post by: StarGeek on August 20, 2021, 11:03:55 AM
Something like this?

exiftool -if '$Rating == 3' -FilePath /path/to/files/
or
exiftool -if '$Rating>3 and $Rating<5' -FilePath /path/to/files/
Title: Re: Can I use ExifTool to search for files with given tag value?
Post by: Joanna Carter on August 21, 2021, 12:48:31 PM
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