Page 1 of 1

Go back to top folder after "Run rules on folder contents"

PostPosted: Sat Aug 19, 2017 12:54 pm
by bonn
How can I "go back" to have Hazel process the top folder, AFTER "Run rules on folder contents" (i.e. subfolders).

My automation is this:

RULE 1: If KIND is FOLDER > Run rules on Folder Contents [Run rules on mp3s inside Subfolders inside the Top folder]
RULE 2: If KIND is MUSIC > Move to Monitored Folder [Move mp3s in Subfolder → Top folder]

In the next step, I want to run rules on all files in the [Top Folder], many of which I moved out of the subfolders. But I don't know how I am supposed to tell Hazel to move up from the [Subfolder] processing.

RULE 3: If KIND is MUSIC [in Top Folder] > Do whatever ...

Re: Go back to top folder after "Run rules on folder content

PostPosted: Mon Aug 21, 2017 10:47 am
by Mr_Noodle
I think the issue here is that rule 2 is overriding rule 3. You should add a condition to rule 2 to only match is the subfolder depth is greater than 0 (so that it only applies to files in subfolders). After that, I believe it should work.

Re: Go back to top folder after "Run rules on folder content

PostPosted: Mon Aug 21, 2017 4:44 pm
by bonn
Mr_Noodle wrote:I think the issue here is that rule 2 is overriding rule 3. You should add a condition to rule 2 to only match is the subfolder depth is greater than 0 (so that it only applies to files in subfolders). After that, I believe it should work.


Thanks for your reply. I don't think that's the problem. I'm attaching screenshots so you can see my actual rules.

Image

The "Topfolder" (or perhaps what you could call the Monitored Folder) is "test2".

Image

I've attached the rules to "test2".

Image

1. This is the first rule. As I understand it, it tells Hazel that following rules should be run on Subfolders in the Monitored Folder (test2)

Image

2. This is the second rule. I modified it with your suggestion. Either way, it moves Music files in Subfolders to the Monitored Folder.

Image

3. This is the third rule. I am unable to get it work. I want to throw away the now-empty subfolders in the Monitored Folder (after moving the mp3s to it).

So the question is how to make Hazel stop running rules on folder contents (should it really say subfolder contents?) and go back to processing stuff normally. Or am I missing something?

Rule 2 is working, i.e. it moves the file "United in F...2017.mp3" to "test2". But Rule 3 doesn't work, i.e. the folder "subfolder" isn't moved to trash.

If I remove the first rule (folder contents), then the subfolder will move to Trash, but not if the first rule is activated.

Re: Go back to top folder after "Run rules on folder content

PostPosted: Tue Aug 22, 2017 10:42 am
by Mr_Noodle
Sorry, I misunderstood. For some reason I thought you wanted to move the files to the trash, not the folders.

Are the folders empty after moving the music files out? If so, you can add a condition like "Size is 0" or "Sub-file count" is 0. You'd also need to move that rule to the top so that it's above the rule to go into subfolders.

Re: Go back to top folder after "Run rules on folder content

PostPosted: Tue Aug 22, 2017 3:52 pm
by bonn
Mr_Noodle wrote:Sorry, I misunderstood. For some reason I thought you wanted to move the files to the trash, not the folders.

Are the folders empty after moving the music files out? If so, you can add a condition like "Size is 0" or "Sub-file count" is 0. You'd also need to move that rule to the top so that it's above the rule to go into subfolders.


Thanks for the explanation, it works when putting the Trash rule for "Sub-file count" in the top. The only caveat is that it takes Hazel two passes two complete all actions.

I also added an additional rule on top that is supposed to run on the top folder (Sort Music > 30 min → Folder "- Mixes"), but strangely that new rule would still run on subfolders despite being above the "Run on folder contents" rule. Not sure why, but I solved it by adding a "Subfolder Depth is 0" rule so it wouldn't run on subfolders. It works as intended now. If you're interested, I've attached a screenshot of all the rules (that now seem to work).

Image

Image

Image

Image

Image

Re: Go back to top folder after "Run rules on folder content

PostPosted: Wed Aug 23, 2017 11:00 am
by Mr_Noodle
I suggest checking out this chapter in the manual: https://www.noodlesoft.com/manual/hazel ... -of-rules/

It doesn't matter if a rule is above the subfolder rule. Depending on how you set up the conditions, the rules, by default, will run at all levels.

That said, your rule does limit it to subfolder depth 0. I'd need to see some other evidence (logs) to understand why it's working elsewhere.