Attribute Reference

Each rule starts with one or more conditions you specify. Each condition, in turn, starts with an attribute—a quality of a file or folder in the monitored folder that Hazel can examine. Conditions can use a wide selection of attributes. (And, if none of these attributes provide you with the information you need, you can create your own custom attributes using AppleScript, JavaScript, or match patterns. See  Using Custom Attributes  for details.)

Hazel recognizes the following attributes:

Name

The name of the file (or folder), without any extension. So, if you have a file called  example.jpg , this attribute matches against  example .

Extension

The file’s extension, which is the part of the file name after the last dot (.). The file  example.jpg  has the extension  jpg . (By default, extensions are hidden in the Finder, but Hazel matches them regardless of whether they’re visible. To toggle the visibility of extensions in the Finder, go to Finder > Preferences > Advanced and select or deselect “Show all filename extensions.”)

Full Name

The full name of the file (or folder)—that is, the name plus the extension.

Date Added

The date (including time) when the file was added to the current folder. This attribute is useful for determining how long a file has been in the monitored folder. (See  Note  below.)

Date Created

The date (including time) the file was created. (See  Note  below.)

Date Last Modified

The date (including time) the file was last changed. (See  Note  below.)

Date Last Opened

The date (including time) the file was last opened. (See  Note  below.)

Date Last Matched

The date (including time) when the file or folder last matched a rule and the rule’s actions ran successfully. (See  Note  below.)

Current Time

The current time at the moment the rule runs. (See  Note  below.)

Note:  When using any of the above “Date” attributes with “occurs before” or “occurs after,” or the “Current Time” attribute, keep in mind that Hazel treats each day as starting or ending at midnight. So, if you set up a condition like “current time is after 10 p.m. on weekdays,” the condition matches only from 10 p.m. until midnight each weekday—Hazel does not consider 12:01 a.m. the following morning to be “after” 10 p.m.

Kind

The type of file, such as a document, movie, or folder. With second pop-up menu set to “is” or “is not,” choose “Other” from the third pop-up menu to display a list of all available file types on your Mac.

Tags

Any tag that can be assigned in the Finder. When the second pop-up menu is set to “contains tags” or “does not contain tags,” clicking in the field that appears displays a list of all currently defined Finder tags (click Show All to display all tags if the list is long). If the second pop-up menu is set to “contain” or “do not contain,” you can enter any freeform text in the field.

If the second pop-up menu is set to “match” or “do not match,” you can enter a  match pattern  in the field, and optionally grab text so that it can be used in your actions.

Color Label

The color label, if any, applied to the file. This will match any of the tags which are currently associated with that color.

Comment

Freeform notes associated with a file or folder. You can see and edit these comments in the Finder by selecting the file or folder and choosing “File” > “Get Info.”

Size

The size of the file. Because of the way OS X calculates sizes, this figure (the actual size) may be less than the amount of space the file occupies on disk.

Contents

The text content of the file. If the second pop-up menu is set to “contain” or “do not contain,” you can match any words that Spotlight has indexed for this file. That is, if you can find the file via Spotlight using a certain word, Hazel can also match that word in the file’s contents.

If the second pop-up menu is set to “contain match” or “do not contain match,” you can enter a  match pattern  in the field, and optionally grab text so that it can be used in your actions.

Source URL/Address

The URL or email address the file came from. Note that only certain apps, such as Safari and Apple Mail, store this information.

Subfolder Depth

The number of subfolders in the folder, starting from the folder being monitored. This is useful only if you have a rule set up to descend into subfolders using the “Run rules on folder contents” action (see  Processing Subfolders ). A subfolder depth of 0 indicates the folder being monitored.

Sub-file/folder Count

How many files and folders are contained by the item being matched by the rule (preferably a folder). This only counts the number of items at the top level of the monitored folder, not those contained in subfolders. If the current item being processed is a file, this number is 0. (This is similar to Spotlight’s Number of Items attribute except, that this does not include hidden files in the count.)

Any File

This attribute matches all files (and folders). This is useful when the final rule for a given folder is a “catch-all” rule that applies to any files or folders that don’t match any of the previous rules—but it makes sense only when it is the sole condition in a rule.

Passes AppleScript

Allows you to provide an AppleScript to evaluate the file. For details on writing AppleScript for Hazel, see  Using AppleScript or JavaScript .

Passes JavaScript

Allows you to provide a JavaScript to evaluate the file. For details on writing JavaScript for Hazel, see  Using AppleScript or JavaScript .

Passes shell script

Allows you to provide a shell script to evaluate the file. For details on writing shell scripts for Hazel, see  Using Shell Scripts .

Other

This attribute allows you to select any Spotlight attribute, of which OS X may have dozens or hundreds (depending on which apps you have installed).

SEE ALSO

Using Match Patterns in Conditions

Using Custom Attributes

Using the Counter Attribute

Action Reference