Going into Subfolders

  Back to search results

By default, Hazel only processes files at the top level of a folder. Let’s look at the following folder structure:

subfolderstructure

If Hazel is monitoring Folder A, then in the normal course of things, it will apply rules against File 1, File 2 and Folder 3. The files within Folder 3File 4 and File 5, will not be processed.

Note that if you want to do something to a folder based on the files under it (not do something to the files themselves), you don’t want to use this; instead use a nested condition.


 

Before proceeding, it is highly recommended that you pause processing for this folder when setting up your rules to do this. Make heavy use of the Rule Preview and Status window (click on the status button) to make sure everything works as expected before resuming rules. Having Hazel going into subfolders can make a mess if you don’t do it correctly.


 

If you want to apply rules to those files, you need to create a separate rule to tell Hazel to go into subfolders.

gointosubfolders

What this does is tell Hazel whenever it sees a folder, go into it, matching rules against the items within it as it is already doing with the top-level items. Now, Hazel will see Folder 3 is a folder and go into it, and then apply the ruleset to File 4 and File 5 as well.

An important thing to keep in mind is that if you want to process the files within, make sure to have those rules separate from this one. Combining the logic will not work.

In most cases, you should not modify the above rule. Only do so if you fully understand the mechanism behind it.

Do not do this:

badsubfolderrule

The above rule makes no sense as it is trying to apply to folders and music files at the same time. Make sure you keep that logic separate and use different rules for each case.


With this rule in place, you can create other rules to handle the content inside the folders. In addition, you can use the Subfolder depth attribute to have certain rules only apply at certain levels below the top level.