Each rule can have one or more actions that Hazel performs if the condition(s) match a given file or folder in the monitored folder. Hazel provides an extensive list of actions from which you can choose; most of these can be customized to meet your exact needs. (You may need to click the Options
icon next to the action to display some of its options.)
Hazel offers the following actions:
Move
Move the file or folder to the specified destination folder.
Click the Options
icon to display additional settings:
-
In the “If file exists” section, select “rename the file,” “replace the existing file,” or “throw the file away” to tell Hazel how to treat the newly processed file if a file of the same name appears at the destination. Renaming appends a number to the newly processed file.
-
Select the “Throw away if a duplicate” checkbox to move the new file to the Trash only if it is identical to (not merely named the same as) a file at the destination.
-
If the matched item is a folder, you can also specify that some of the folder structure be copied over, as described in Copying Folder Structure .
This action will fail if the source and destination folders are the same.
Copy
Copy the file or folder to the specified destination folder.
Click the Options
icon to display additional settings:
-
In the “If file exists” section, select “rename the file,” “replace the existing file,” or “do not copy the file” to tell Hazel how to treat the newly processed file if a file of the same name appears at the destination. Renaming appends a number to the newly processed file.
-
Select the “Do not copy if a duplicate” checkbox to refrain from copying the file if it is identical to (not merely named the same as) a file at the destination.
-
If the matched item is a folder, you can also specify that some of the folder structure be copied over, as described in Copying Folder Structure .
Note that subsequent actions in the same rule apply to the copy and not the original.
Rename
Rename the file or folder. You can specify a pattern to use for the renaming, as described in Using Patterns in Actions . Patterns for renaming can also include user-configurable counters; see Using the Counter Attribute .
Sort into subfolder
Sort the file or folder into a subfolder of the monitored folder based on a specified pattern, as described in Using Patterns in Actions . If the folder does not exist, Hazel will create it as needed. Note that you can indicate additional levels of folders by using the ▸ token. Also, the “Anything” (…) attribute can be used to match against partial names of existing folders, although Hazel can’t create folders based on partial names.
Click the Options
icon to display additional settings:
-
In the “If file exists” section, select “rename the file,” “replace the existing file,” or “do not upload the file” to tell Hazel how to treat the newly processed file if a file of the same name appears at the destination. Renaming appends a number to the newly processed file.
-
Select the “Do not copy if a duplicate” checkbox to refrain from copying the file if it is identical to (not merely named the same as) a file at the destination.
Sync
Sync the file or folder to the destination. This is similar to “Copy,” except that “Sync” copies only those items that have been added since the last time the rule ran. Syncing is one-way; files changed in the destination folder are not copied back to the monitored folder. Deletions from the source folder can be synced to the destination, but qualifications apply; see Syncing Folders for more information.
Upload
Upload the file or folder to a server via FTP, SFTP, or WebDAV; see Specifying Upload Options for details.
Click the Options
icon to display additional settings:
-
In the “If file exists” section, select “rename the file,” “replace the existing file,” or “do not upload the file” to tell Hazel how to treat the newly processed file if a file of the same name appears at the destination. Renaming appends a number to the newly processed file.
-
If the matched item is a folder, you can also specify that some of the folder structure be copied over, as described in Copying Folder Structure .
Add tags
Add the specified tags to the file or folder. You can also add Dynamic Tags, in which the tags are created on the fly based on file metadata and custom attributes you create. See Using Patterns in Actions for more details on how to use patterns to create Dynamic Tags.
Remove tags
Remove the specified tags from the file or folder. You can remove all the existing tags on a file removed by using the “Any Existing Tags” option. You can also specify Dynamic Tags, in which the tags are created on the fly based on file metadata and custom attributes you create. See Using Patterns in Actions for more details on how to use patterns to create Dynamic Tags.
Set color label
Set the color label on the file or folder. Click the ✕ icon to remove the color label. This action sets the tags associated with the given color, and removes any other colored tags.
Add comment
Add a Spotlight-searchable comment to the file or folder. If you include the “Comment” attribute in your pattern, it will include any existing comments in your new comment; otherwise, Hazel replaces the existing comment with your new comment.
Toggle extension
Set whether the file’s extension is hidden or visible in the Finder.
Archive
Convert the file or folder to a Zip file, just as if you used the Finder’s Compress feature. Note that subsequent actions in the same rule operate on this new archive; the original item is moved to the Trash.
Unarchive
If the file is an archive, it is decompressed. Note that subsequent actions in the same rule operate on the decompressed file or folder; the original archive file is moved to the Trash. This action will fail if the file is not an archive.
Open
Open a file or folder. You can specify a specific application or use “Default Application” to open the file with the application that would normally open it when you double-click it. You should exercise caution when opening files from untrusted sources; structure your rule conditions appropriately. Also, if you use this action, you should disable any browser options that will cause it to open files; otherwise, files may open twice. Click the Options
icon to display an additional setting: “Bring to front.” Select this checkbox to bring the newly opened item to the front; otherwise, Hazel opens it but leaves it in the background.
Show in Finder
Open a new Finder window with the file or folder selected. Click the Options
icon to display an additional setting: “Bring to front.” Select this checkbox to bring the Finder to the front; otherwise, Hazel selects the newly processed item but leaves the Finder in the background.
Make alias
Create an alias to the file or folder in the specified folder.
Import into Music
Import the file into Music. The original file remains in place, so depending on your Music settings, you may want to move it to its proper place beforehand (if you have Music set to not copy files) or throw it away afterwards (if you have Music set to copy files). Note that Music will open if it is not already running.
Import into Photos
Import the file into Photos. The original file remains in place, so depending on your Photos settings, you may want to move it to its proper place beforehand (if you have Photos set to not copy files) or throw it away afterwards (if you have Photos set to copy files). Note that Photos will open if it is not already running.
Import into TV
Import the file into the TV app. The original file remains in place, so depending on your TV settings, you may want to move it to its proper place beforehand (if you have TV set to not copy files) or throw it away afterwards (if you have TV set to copy files)..
Run AppleScript
Run an AppleScript. For details on writing AppleScript for Hazel, see Using AppleScript or JavaScript .
Run JavaScript
Run a JavaScript. For details on writing JavaScript for Hazel, see Using AppleScript or JavaScript .
Run Automator workflow
Run an Automator workflow. For details on writing Automator workflows for Hazel, see Using Automator .
Run shell script
Runs a shell script or any command-line program. For details on writing shell scripts for Hazel, see Using Shell Scripts .
Run rules on folder contents
This action causes Hazel to run the full rule list on the files and folders contained in this one. You should make sure you have a condition specifying “Type is Folder,” as this action will fail if run on a file. If subfolders match a rule with this action, Hazel continues to descend as needed. But be careful about allowing Hazel to descend too far, as this will delay processing of subsequent files. For more information, see Processing Subfolders .
Continue matching rules
This action tells Hazel to continue matching against subsequent rules instead of stopping. Normally Hazel stops once it finds a match, but this action indicates that rule evaluation should continue. Note that you cannot continue evaluation if the file or folder is moved out of the monitored folder. Therefore, you can’t use this action in conjunction with the “Move” or “Sort into subfolder” actions.
Display notification
Display a notification on screen using Notification Center (see
Notifications
). You can also set a sound to play along with the notification by clicking the Options
icon. Notifications can include not only static text but also dynamic patterns, as described in
Using Patterns in Actions
.
Ignore
This action does nothing. It’s useful for ensuring that certain files are not processed. For instance, you can set a rule at the beginning of a list to exclude certain files from any subsequent rules. This action makes sense only when it is the sole action in a rule.
SEE ALSO
Using AppleScript or JavaScript