File Munging with Hazel

Hazel is one of those apps that runs in the background and ruins my expectations for any Mac without it. It’s so perfectly subtle that I forget it’s constantly making my work easier.

In addition to generally keeping my Mac in good order I also put Hazel to work as a single-use file munger.

Here’s an example workflow that scans through all subfolders in a directory, pulls out the files and saves them to a new location in a folder structure like YYYY/MM. The trick is understanding how Hazel executes multiple rules on a folder. The first rule in a sequence executes before the next rules are called.

In this case the first rule tells subsequent rules to run on the contents of the folder Hazel is monitoring.

The next rule in the sequence gathers up all files and moves them to a new folder structure. This particular case was used to extract and reorganize some of my photos.

There’s a good post on the Hazel forum describing how this works. The short summary is that the first rule tells Hazel to dip into the first folder and process the contents with subsequent rules. When it hits another folder the first rule runs again and tells it to dive into that folder and start the process over again.

The revelation that Hazel can be a single-use tactical tool was one of my favorite discoveries of the app. Now I just keep this combination of rules sitting around idle. When I want to process a different folder I copy the Hazel rules into the new folder configuration. It’s also possible to create a permanent set of file sifting folders. Create one called “Sort by Creation Date” for this example. I don’t need it that often so I prefer to just work in Hazel.