Tag a folder based on contents?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Tag a folder based on contents? Sat Feb 09, 2019 6:34 pm • by fullcity
Here's what I am trying to achieve...

I have a folder (we'll call it "Parent") of folders ("Child A", "Child B" and "Child C"). I'd like a rule that crawls the child folders and tags them if the folder contains a file with a specific extension. Is this possible?

For extra credit... is it possible for the rule to run on the folders within the child folders?

I've wracked my head trying to get this sorted out. Any help is appreciated.

/fc
fullcity
 
Posts: 2
Joined: Sat Feb 09, 2019 6:28 pm

Re: Tag a folder based on contents? Mon Feb 11, 2019 11:36 am • by Mr_Noodle
You can use nested conditions to do that. It would look something like:
Code: Select all
   If (all) are met
       If (all) are met for (any subfiles)
           Extension is <<<blah>>>

That will match a folder is a file contains the specified extension.

As for your second question, search the manual for "subfolders". Note, though, that depending on the details, this may not be what you need. It would be better if you provided more specifics about what you are trying to do.
Mr_Noodle
Site Admin
 
Posts: 7981
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Tag a folder based on contents? Mon Feb 11, 2019 1:48 pm • by fullcity
Thank you for the response!

In short I want to recurse through the subfolders of the folder I am running a rule on and run a rule on those as well. For instance if my rule is set to tag a folder if there is a pdf in the folder I'd like the folder to be tagged only when there is a PDF in that folder and determine separately whether the subfolders should be tagged if those also have a pdf in them.
fullcity
 
Posts: 2
Joined: Sat Feb 09, 2019 6:28 pm

Re: Tag a folder based on contents? Tue Feb 12, 2019 12:00 pm • by Mr_Noodle
What if a folder contains a folder which has a PDF?

Using nested conditions and "Run rules with folder contents" in this case could be very resource intensive. Instead of using the nested condition, it might be better to have the rule match the file with the tag directly, then use an AppleScript to re-target the actions to the enclosing folder.

Here's a link to a thread with an example: viewtopic.php?p=1545#p1545
Mr_Noodle
Site Admin
 
Posts: 7981
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron