Apply label to empty folders

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

Moderator: Mr_Noodle

Apply label to empty folders Mon Apr 02, 2012 4:57 pm • by tkilgour
I'm new to Hazel so I'm having trouble creating this:

I want Hazel to monitor my entire Dropbox folder (including all subfolders), and apply a label to any folder that is empty. I don't want to delete it, just to easily tell it apart.

I think I'm getting tripped up on getting it to properly go into subfolders, because I've manage to get the first-level folders to be labelled (I'm assuming because they have an empty folder somewhere in their sub-folders...), but nothing else.

Thanks for any help.
tkilgour
 
Posts: 4
Joined: Mon Apr 02, 2012 4:50 pm

Re: Apply label to empty folders Mon Apr 02, 2012 5:05 pm • by a_freyer
Three rules will solve the problem you've presented:


Code: Select all

Rule 1: Label Empties

If (All) of the following are true ...
     Kind is Folder
     Size is 0 bytes

Then
     Set color label to _______



Code: Select all

Rule 2: Un-Label Full

If (All) of the following are true ...
     Kind is Folder
     Size is greater than  0 bytes

Then
     Set color label to BLANK



Code: Select all

Rule 3: Dive into Subfolders

If (All) of the following are true ...
     Kind is Folder

Then
     Run rules on folder contents.

a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Apply label to empty folders Mon Apr 02, 2012 5:06 pm • by Mr_Noodle
I was typing a response as a_freyer's post came in. So, uh, yeah, what he said.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Apply label to empty folders Mon Apr 02, 2012 5:41 pm • by tkilgour
I still can't get it too work...
I didn't understand the concept of the "Run rules on folder contents". So it applies all the rules for that folder to all its subfolders? What if I have other rules for the same folder that I don't want to be applied to subfolders?

Here are my three rules.

Image

Image

Image
tkilgour
 
Posts: 4
Joined: Mon Apr 02, 2012 4:50 pm

Re: Apply label to empty folders Mon Apr 02, 2012 5:45 pm • by Mr_Noodle
Check the preview. See what it thinks the size is.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Apply label to empty folders Mon Apr 02, 2012 5:56 pm • by a_freyer
tkilgour wrote:So it applies all the rules for that folder to all its subfolders?


Yup. It will apply ALL rules to ALL subfolders, as our rules are currently written.

tkilgour wrote:What if I have other rules for the same folder that I don't want to be applied to subfolders?


It will also run those rules too. One way to prevent this is to add something like this to your other rules:

Code: Select all

If (all) of the following are true:
     ... your rule criteria ...
     Subfolder depth = [THE SUBFOLDER DEPTH OF THE FOLDER THAT THIS RULE SHOULD UNIQUELY APPLY TO; FOR YOU I THINK THIS IS PROBABLY 0]

Then
     ... your actions....


Subfolder depth is defined like this:

Code: Select all
0. Folder that you're monitoring (e.g. Dropbox for you)
    1. Any folder at this level
           2. Any folder at the third level
                  3. other
           2. Still subfolder depth of 2
    1. Still subfolder depth of 1
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Apply label to empty folders Mon Apr 02, 2012 5:58 pm • by tkilgour
I can only see what it applies to the first level of folders and (obviously) they're all full... is there a way to see what it is applying to the subfolders?
tkilgour
 
Posts: 4
Joined: Mon Apr 02, 2012 4:50 pm

Re: Apply label to empty folders Mon Apr 02, 2012 6:02 pm • by tkilgour
Thanks a_freyer, I get it now. It doesn't seem very intuitive though... It seems like there should be a way to turn it on for each rule...
tkilgour
 
Posts: 4
Joined: Mon Apr 02, 2012 4:50 pm


Return to Support