Syncing Folders

Hazel’s Sync action copies items from the monitored folder to another folder—but unlike the Copy action, Sync copies only those items that have been added since the last time the rule ran. So you can think of it as being like a smarter or more efficient Copy.

Syncing items in Hazel differs from how some utilities use the word “sync.” You’ll get better results with the Sync action if you understand its limitations. Specifically:


Sync a Subfolder (including Deletions)

Here’s how you can set up Hazel to sync an entire subfolder of a monitored folder, including deletions. To be clear, if the monitored folder is “Monitored Folder” in the example below, the folder you want to sync—inside the monitored folder—is called “Synced Folder” and the destination is “Destination Folder,” the result after syncing will look like this:

That is, the contents of “Synced Folder” don’t sync directly to the top level of “Destination Folder,” but rather to subfolder “Synced Folder” within “Destination Folder.” Anything deleted from “Synced Folder” in the monitored folder is deleted from the “Synced Folder” at the destination. Syncing is only one-way; changes in the “Synced Folder” subfolder of “Destination Folder” do not sync back to “Synced Folder” in the “Monitored Folder.”

The rule that performs this sort of sync looks like this:

You can create this rule manually (be sure to read  Using Nested Conditions  for help with the last four lines in the “conditions” section), or, if you prefer, you can download this rule using the following link:  sync.hazelrules . After you’ve downloaded the rule, open Hazel, select the folder you want to monitor (that is, the folder that  contains  the folder you want to sync), and drag the rule into its “Rules” list. Then edit the rule and replace the name of the “Synced Folder” and the “Destination Folder” with the folders you want to sync.

This rule looks for a folder inside the monitored folder with the name you specify. When Hazel detects changes in that folder—or in any of the subfiles or subfolders within it—the “Sync” rule runs, copying the contents of the synced folder to the destination folder.

Note that the conditions shown here merely tell Hazel  when  to sync (in this case, whenever the subfolder is modified). If you prefer, you can use entirely different conditions (such as Current Time is 12:00 AM any day) to specify a different schedule or frequency. Regardless of the conditions, the “Sync” action itself behaves the same way.

Tip:  The conditions in this example rule are applicable to many actions, not just syncing. You can use the same conditions to trigger any action every time something is modified.

Because this rule runs every time “Synced Folder” or anything inside it changes, it can bog down your Mac a bit if that folder contains a large number of items. If you want to limit how often it runs, you can do so by adding “Date Last Matched is not in the last 10 minutes” (or however long you want the interval between runs to be) to the top of the conditions list.

SEE ALSO

Processing Subfolders

Using Nested Conditions

Action Reference

Copying Folder Structure

Specifying Upload Options