MacOS – Automatically apply tag to folder based on content

finderfinder-tagmacos

Is anyone aware of a way to automatically apply a given Finder tag to a folder based on its contents?

For example, I can easily run a Finder search for files based on their "Document Container".
But it seems there is no way to get containers based on files they contain. What I'm trying to do is to apply tag "X" to all folders that contain one or more files with file extension "Y".
It seems there's no way to do it directly from Finder but I haven't been lucky with Automator either as I can't seem to find a way to select a range of folders based on what they contain.

Best Answer

The proper tool for this job is Hazel.

It can apply tags based on file names, file extensions, even file contents and a lot more. It can also do that on sub-folders as well.

The app has been around for a long time, its developer is very well respected, and the app is well worth its asking price.

There’s a free trial available which you should download and try before buying, but it’s an essential tool for me, and much easier to deal with than Automator and Folder Actions.

Updated To Add

I’m 99% sure that Hazel can do this (if I am understanding the idea properly), and would recommend checking out this page as a starting point:

https://www.noodlesoft.com/manual/hazel/advanced-topics/processing-subfolders/

The developer is also very responsive. The best place to ask questions is here:

https://www.noodlesoft.com/forums/