Copying Folder Structure

Certain actions, such as Move, Copy, and Upload, have an option to copy the folder structure, and not just the file or folder being processed. This option enables you to mirror the folder structure at the file’s destination.

To enable this option, click the Options   icon in the action, select “Copy folder structure,” and then choose the structure you prefer from the pop-up menu, as shown below. (By default, this option is disabled and no folder structure is copied, which means any file or folder processed by your rule is placed at the top level of the destination folder.)

When “Copy folder structure” is enabled, the structures you can choose are:

  • “parent folder only”:  Use only the name of the parent folder of the file or folder being processed. (This is the default choice.)

  • “from monitored folder”:  Use the path from the monitored folder to the parent folder of the file or folder being processed.

  • “from root”:  Use the full path from the top level of the volume (not including the volume name) to the parent folder of the file or folder being processed.


Folder Structure Examples

To illustrate how the three folder structure options work, let’s look at an example (which you can duplicate on your own Mac and try yourself).

We begin with the following structure somewhere on your disk:

Next, we set up Folder A as a monitored folder and then create two rules:

The first rule, which tells Hazel to  process subfolders , looks like this:

The second rule uses the “Move” action (although “Copy” or “Upload” would also work), in this case using a folder named “Backup” as the destination:

Now, we move File1 into Folder B (as shown below) and let the rule run.

File1 is moved to the Backup folder in one of three ways, depending on the option used:

  • “parent folder only”:   Folder B . That is, the new file’s parent folder (Folder B) is recreated within the Backup folder, and the file is moved to that folder.

  • “from monitored folder”:   Folder B . In this case, the results happen to be exactly the same as with the “parent folder only” option, because the monitored folder itself (Folder A) isn’t included in the path. (If File 1 were instead placed at the top level of Folder A, the file would instead be moved to the top level of Folder B.)

  • “from root”:   Folder A   Folder B . That is, the new file’s path from the monitored folder (Folder B, in side Folder A) is recreated within the Backup folder, and the file is moved to the new Folder B.


Next, suppose we move File2 into Folder D (as shown below) and let the rule run.

File2 is again moved to the Backup folder in one of three ways, depending on the option used:

  • “parent folder only”:   Folder D . That is, the new file’s parent folder (Folder D) is recreated within the Backup folder, and the file is moved to that folder.

  • “from monitored folder”:   Folder B   Folder C   Folder D . That is, the new file’s path from the monitored folder (Folder D, inside Folder C, inside Folder B) is recreated within the Backup folder, and the file is moved to the new Folder D.

  • “from root”:   Folder A   Folder B   Folder C   Folder D . That is, the new file’s full path (Folder D, inside Folder C, inside Folder B, inside Folder A) is recreated within the Backup folder, and the file is moved to the new Folder D.

So, if we are moving files to a folder called Backup and using the “from monitored folder” option (the second example just above), we would end up with a folder structure like this:

By getting the path up to (but not including) the monitored folder, Hazel can reproduce the path from Folder B downward in the new location.

SEE ALSO

Action Reference

Relocating Folders