How to get a ruleset out of subfolders?

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

Moderator: Mr_Noodle

How to get a ruleset out of subfolders? Mon Oct 17, 2022 2:24 pm • by klschn
Hi!

I regularly save/copy/move a lot of archives to folder watched by Hazel. Sometimes in bulk. I would like Hazel to help me clean up those archives.

The desired ruleset would be:

1. Unzip all archives in the watched folder
2. Look into the unzipped folders and remove certain files („bla.txt“ and „blubb.md“) from these folders.
3. After cleaning up - zip up those folders.
4. Move the cleaned up ZIP-Files to another directory.

I got this working up to step 2 with „Run rules on folder contents“ but how do I make Hazel zip up those folders – get out of those subfolders?
klschn
 
Posts: 3
Joined: Mon Oct 17, 2022 2:21 pm

Re: How to get a ruleset out of subfolders? Tue Oct 18, 2022 9:37 am • by Mr_Noodle
It doesn't quite work like that, or at least you are thinking of it wrong. Just create a new rule for 3 & 4. It is applied from the top and only goes down if you tell it to go into subfolders. If you precede the subfolder rule with a rule to match the folder, then you can prevent it from going into it.

It's up to you to determine whether a folder should be zipped up or descended into.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: How to get a ruleset out of subfolders? Wed Oct 19, 2022 2:58 pm • by klschn
Thanks Mr Noodle, but I’m not quite there yet ;-(

I now have set up 5 individual rules
1. If kind is archive > unarchive
2. If kind is folder > run rules on folder contents
3. If name starts with „unwanted“ > move to trash
4. If kind is folder > archive
5. If kind is archive > move to a different directory

All rules work individually, but having all rules checked, Hazel stops after deleting the unwanted files (rule 3).

The only possible conflict I see (if Hazel is not stuck in the subfolder) is that I have two rules (2 and 4) with the folder condition.

Help still appreciated.
klschn
 
Posts: 3
Joined: Mon Oct 17, 2022 2:21 pm

Re: How to get a ruleset out of subfolders? Thu Oct 20, 2022 9:54 am • by Mr_Noodle
The order of the rules matter. If you use the rule status interface, you'll see how things play out.

Basically, all folders will match rule 2 and never get to rule 4. You need to add some conditions to distinguish when to do one action on a folder over the other and order the rules appropriately.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: How to get a ruleset out of subfolders? Mon Oct 24, 2022 5:20 am • by klschn
Sorry, but for the life me – I don’t get this to work. Individual rules work fine but in sequence they stop and seem stuck after cleaning up „inside“ the folder.

Should you have any hints on how to set up a rule or a set of rules that remove(s) certain/specific files from archives and moves the „cleaned up“ archives to a different folder – that would be much appreciated.
klschn
 
Posts: 3
Joined: Mon Oct 17, 2022 2:21 pm

Re: How to get a ruleset out of subfolders? Mon Oct 24, 2022 10:10 am • by Mr_Noodle
Try using the rule status UI. That will show you how your file is not matching the rule you want and should aid you in re-ordering them to get it to work.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron