If any file in the folder or any of the sub-folders

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

Moderator: Mr_Noodle

Hi,

I am having trouble figuring out a setting where, if there is any file in the folder, or any file in any of the sub-folders, then change the color tag of the folder to green. Otherwise, change it to red.

This need of tagging with color labels is based on structure of our project folders, where we have a standardized set of folders. Now, only much longer into the process, all folders will be utilized. In the beginning of a project, it is extremely helpful to have color tags indicating if there are any files in the subfolders.

Is this doable? I've tried various settings, and I wish there was a condition that was called "if sub-file count is less than 1, then color red, otherwise, color green".

Any help is appreciated. Thanks in advance.

/Claus
clausneergaard
 
Posts: 9
Joined: Wed Aug 06, 2014 2:52 am

Hold down the option key while clicking the + button to create a new condition. This creates a nested condition. There, you can set the target to "any of it's sub-files". By using this construct, you can have a rule match a folder, based on conditions applied to the files underneath it, which is what I believe you want here.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks a bunch, Mr_Noodle, I will try with this method. Thanks!
clausneergaard
 
Posts: 9
Joined: Wed Aug 06, 2014 2:52 am

Hi again,

I still cannot make it work, this setup of Hazel running through all folders and all subfolders, checking if there are any files located within the folder structure.

The idea is still to apply either green or red color tags, depending on wether or not the path has a file located within its subfolders. The hazel-setup should only label the folders, not the files, even though it needs to evaluate if there are files in the folder structure. It is a bit tricky to describe, maybe linked image could help explain the idea further (https://www.dropbox.com/s/6q977jytaw936vz/ScreenDump.png?dl=0).

I think part of the problem could be that it somehow needs to work "backwards"? Meaning it has evaluate from the outer ends of the folder structure and back towards the root of the folder.

Any help/input is appreciated.

Thanks!

/Claus
clausneergaard
 
Posts: 9
Joined: Wed Aug 06, 2014 2:52 am

Can you post the rules you are using now?
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for your reply, Mr_Noodle,

Here is the rule for applying the green label tag, meaning that there is a file in one of the subfolders:
https://www.dropbox.com/s/59pfnjwve1dq69n/Screen%20Shot%202014-11-05%20at%2009.13.26.png?dl=0

Here is the rule for applying the red label tag, meaning that there is a no file in any of the subfolders, but there can still be subfolders:
https://www.dropbox.com/s/e3wr037wfhnbfnr/Screen%20Shot%202014-11-05%20at%2009.13.00.png?dl=0

Thanks, hope this helps clarify things a bit.

/Claus
clausneergaard
 
Posts: 9
Joined: Wed Aug 06, 2014 2:52 am

How is this not working? Is one of the rules working and not the other?
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Well - I am actually unsure which of the two rules that doesn't work the way I am hoping it would.

Please see following image which hopefully helps understanding my problem. https://www.dropbox.com/s/9kv7rbvj2yiq32l/ScreenDump02.png?dl=0.

1) The folders that doesn't carry any files, doesn't get a color label. It should get a red color label, if empty (see, for instance, the folder named 04-02 Organization - it should get a red label, if empty).
2) The folders which carry files, but not any further folders, should get a green label, not a red one (see, for instance, the folder named 04-01 Archival records - it should have a green label, not a red one).

Again - any help is very much appreciated, as I seem to be unable to wrap my head around this.

Thanks.
/Claus
clausneergaard
 
Posts: 9
Joined: Wed Aug 06, 2014 2:52 am

Looking at your screenshots again, I realize you are running a pre-3.3 version. I suggest updating to 3.3.2 and trying again.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle - thanks for all your feedback and replies.

Allright - I've updated the software to 3.3.2.
It still doesn't do the trick. Hmm.

Can I ask how would you go about creating such two rules, that applies color labels according to content/no content, as described in previous posts?

/Claus
clausneergaard
 
Posts: 9
Joined: Wed Aug 06, 2014 2:52 am

How about this? First off, it's not clear that every folder is being descended into. How about splitting out a separate rule that does "Kind is folder -> Run on folder contents". Now add to that rule, a "Continue" action. Make that the first rule.

Now with that in place, you can be sure that every folder is delved into and that the logic afterwards doesn't affect it. Because of the continue action, the rules afterwards can also be applied to the folder that matches. Take out the "Run rules on folder contents" actions from the rules and see how things look after that. In the preview, every folder should match the first rule, and maybe one of the second rules.

Another thing to note, if the folder is empty, it will not match any sort of "any of its subfiles" type conditions. Those require at least something underneath for it to evaluate to true.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks! I'll give it a try, and let you know what happens.
Cheers!

/Claus
clausneergaard
 
Posts: 9
Joined: Wed Aug 06, 2014 2:52 am


Return to Support