About Folders & Rules

Hazel lets you automate the management and organization of your files and folders. You can ask Hazel to watch any number of folders, and for each one, you create one or more rules that detail what should happen to the folder’s contents and under what circumstances.

Hazel can be used to organize almost any folder, but the best candidates are ones that tend to collect files, such as where your browser downloads files, where Mail puts attachments, or a shared Dropbox folder. Hazel can also use Smart Folders (with minor limitations).

What Rules Can Do

Rules in Hazel, much like rules in Apple Mail, specify two things:

You can have Hazel watch any number of folders; and for each folder, you can create any number of rules. Each rule, in turn, can have one or more  conditions  that, when met, trigger one or more  actions .

Conditions

A Hazel rule can match a vast range of conditions—practically anything you can think of. To give just a few examples, a condition can examine attributes such as:

And, multiple conditions can be combined in any way you like—a rule can be set to match any, all, or none of the conditions you specify; and you can even nest conditions to create complex logical tests.

Actions

When your rule matches the condition(s) you specify, it then takes one or more actions. Again, the range of options is immense, but here are a few examples:

Example Rules

Putting conditions and actions together, here are a few examples of complete rules you can create in Hazel:

In cases where a folder has numerous rules, or the conditions and actions are complex, it can take some planning and experimentation to achieve exactly your desired results. For a detailed explanation of Hazel’s logic when processing rules, read  Understand the Logic of Rules .


Anatomy of a Simple Rule

To illustrate how Hazel rules are constructed, let’s look at a simple example. This happens to be one of the sample rules you can install by going to the “Folders” pane, clicking the Action   menu, and choosing “Load Sample Rules.” (For a more thorough orientation, see  The Hazel Preference Pane .)

In this example, the “Pictures” rule is attached to the Downloads folder. You can display the rule either by double-clicking it, or by selecting it and clicking the Edit   button. Then you’ll see something like this:

This rule looks for files in the Downloads folder with a kind of “Image” and, for each one it finds, moves it to the Pictures folder (that is, Macintosh HD   Users   your-username   Pictures).

Here’s what each element does:

Some conditions and actions have more or fewer pop-up menus, require you to fill in blanks, or let you build patterns of various kinds. But they all follow this basic structure, and every condition and action starts with a choice from the leftmost pop-up menu in its row.

SEE ALSO

The Hazel Preference Pane

Work with Folders & Rules

Attributes & Actions