Complicated Folder Deletion Rule

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

Moderator: Mr_Noodle

Complicated Folder Deletion Rule Fri Oct 06, 2017 3:00 pm • by CNg2379
I'd like to try and do some automated disk/folder cleanup based on the presence of a file.

My basic setup is something like this:

A1 - folder
A2 - folder
A3 - folder

B1 - data file (corresponds to data in folder A1)
B2 - data file (corresponds to data in folder A2)
B3 - data file (corresponds to data in folder A3).

After I conduct my manual process, CSV file are generated based on B1, B2, B3.

I would like for Hazel to delete folders A1, A2, A3, after generating B1.CSV, B2.CSV, etc.

I have a feeling that this will require some complicated applescripting, but if there is a simpler Hazel only way any thoughts would be appreciated!
CNg2379
 
Posts: 11
Joined: Mon May 23, 2016 6:59 pm

Re: Complicated Folder Deletion Rule Mon Oct 09, 2017 10:54 am • by Mr_Noodle
Is there some way for Hazel to know that B1 corresponds to A1 using existing metadata? If not, then yes, some sort of script will be needed.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Complicated Folder Deletion Rule Tue Oct 17, 2017 1:44 pm • by CNg2379
Mr_Noodle wrote:Is there some way for Hazel to know that B1 corresponds to A1 using existing metadata? If not, then yes, some sort of script will be needed.


Yes, the actual file names look something like

_experiment1 (this is a folder)
_experiment2 (this is a folder)
experiment1.xxx
experiment2.xxx
CNg2379
 
Posts: 11
Joined: Mon May 23, 2016 6:59 pm

Re: Complicated Folder Deletion Rule Wed Oct 18, 2017 12:05 pm • by Mr_Noodle
A couple of topics to look up in the help:

- Nested conditions
- Custom attributes

I'm not entirely clear on the exact workflow here but you can use nested conditions to match a file based on another file/folder in the same folder. For example:
Code: Select all
    If (all) are met
        If (all) are met for (any file in the same folder)
            Name matches (•file name)
        Kind is Folder
        Name matches (•file name)

What the above does is match any folder which has a file with the same name. You can tweak the above to fit your case.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support