Page 1 of 1

How to apply rules only to subfolders

PostPosted: Tue Mar 27, 2012 6:26 pm
by zdlo
I thought it wouldn't be appropriate to post under the sticky located here: viewtopic.php?f=4&t=470

I can't figure out how to apply rules only to subfolders.

My directory structure looks like this:
Drive/MainFolder/Folder001/Folder001a

Under the main folder, there are a lot of folders (ie. Folder001),
and under each of them, there are subfolders (ie Folder001a).

I want to apply rules only to the subfolders; Folder001a, Folder002a, etc.

Whatever I tried, the preview either showed no rules applied, or rules applied to everything under the MainFolder.

What should I do?

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 1:30 pm
by a_freyer
Set Subfolder depth greater than 0 in the matching section of your rule if the rule exists at the parent folder, else adjust your "greater than" depth appropriately.

So in your case:

Main (Depth = 0)/Folder001 (Depth = 1)/ Folder001a (Depth = 2)

If you want the rule to apply ONLY to Folder001, Folder002 etc. then set subfolder depth to > 0 if the monitored folder is main.

If you want the rule to apply ONLY to Folder001a, Folder001b, Folder002a, etc. then set subfolder depth to > 1 if the monitored folder is main.

You will also need an action that "runs rule on folder contents"

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 1:57 pm
by zdlo
a_freyer wrote:Set Subfolder depth greater than 0 in the matching section of your rule if the rule exists at the parent folder, else adjust your "greater than" depth appropriately.

So in your case:

Main (Depth = 0)/Folder001 (Depth = 1)/ Folder001a (Depth = 2)

If you want the rule to apply ONLY to Folder001, Folder002 etc. then set subfolder depth to > 0 if the monitored folder is main.

If you want the rule to apply ONLY to Folder001a, Folder001b, Folder002a, etc. then set subfolder depth to > 1 if the monitored folder is main.

You will also need an action that "runs rule on folder contents"


Here's what I do:
* I set the rule for MainFolder
* If all of the conditions are met: Subfolder depth is 1
* Do the following:
Run rules on folder contents
Set color label red

When I do that, the preview lists Folder001, Folder002, etc., and "Rule matched" area is empty.

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 2:26 pm
by a_freyer
This is what I think you're looking for:

If all of the contents of a folder match your rule, set the color of the folder to RED.

So, you're going to need two rules:

Rule 1: (However you plan to match the folder contents && subfolder depth > 0) Action for Rule 1: (set folder color red)
Rule 2: (If subfolder depth = 0) Action for Rule 2: (run rules on folder contents) [this will ONLY run on the SubFolder001 level]


Alt1. Rule 2: (If subfolder depth < 2) Action for Rule 2: (run rules on folder contents) [this will run on the SubFolder001 level and the SubFolder001a-z folder levels]

Alt2. Rule 2: (kind is folder) Action for Rule 2: (run rules on folder contents) [this will run on all subfolder levels EXCEPT the MainFolder]

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 2:28 pm
by a_freyer
zdlo wrote:Here's what I do:
* I set the rule for MainFolder
* If all of the conditions are met: Subfolder depth is 1
* Do the following:
Run rules on folder contents
Set color label red


The reason that this won't work is that the MainFolder has a subfolder depth of 0, so you'll never reach the action "run rules on folder contents"

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 2:40 pm
by zdlo
a_freyer wrote:This is what I think you're looking for:

If all of the contents of a folder match your rule, set the color of the folder to RED.

So, you're going to need two rules:

Rule 1: (However you plan to match the folder contents && subfolder depth > 0) Action for Rule 1: (set folder color red)
Rule 2: (If subfolder depth = 0) Action for Rule 2: (run rules on folder contents) [this will ONLY run on the SubFolder001 level]


Alt1. Rule 2: (If subfolder depth < 2) Action for Rule 2: (run rules on folder contents) [this will run on the SubFolder001 level and the SubFolder001a-z folder levels]

Alt2. Rule 2: (kind is folder) Action for Rule 2: (run rules on folder contents) [this will run on all subfolder levels EXCEPT the MainFolder]


So, what should be the rules to apply something only to Folder001a-z levels?

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 2:44 pm
by a_freyer
This should do it:

Rule 1: (However you plan to match the folder contents && subfolder depth = 1) Action for Rule 1: (set folder color red)
Rule 2: (If subfolder depth < 2) Action for Rule 2: (run rules on folder contents)

_______________________________________________

EDITED for error of depth = 2;

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 2:57 pm
by Mr_Noodle
I think all you need to do is for any rule you only want to work on files in subfolders, add:

Subfolder level > 0

That means the rule will only match for files in subfolders and those below it. Do not muck with the "Run rules on folder contents" rule as it seems like you want it to descend as far as possible.

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 3:24 pm
by zdlo
a_freyer wrote:This should do it:

Rule 1: (However you plan to match the folder contents && subfolder depth = 2) Action for Rule 1: (set folder color red)
Rule 2: (If subfolder depth < 2) Action for Rule 2: (run rules on folder contents)


With a little modification, this worked:

Rule 1: If depth = 1, Action "label red"
Rule 2: If depth < 2, Action "run rules on folder contents"

I don't know how, but it worked. I wanted to apply rules ONLY to Folder001a level, and not to Folder001 level, or any files or folders under Folder001a level.

Re: How to apply rules only to subfolders

PostPosted: Wed Mar 28, 2012 4:12 pm
by a_freyer
The reason that this works is that when you "Run on Contents", the Folder001 becomes depth 0 because that is the effective root folder.

Should have mentioned that.