November 03, 2015

Workflow Automation: Hazel

By Drew Barontini

Workflow automation improves efficiency and productivity, and there are a variety of ways to achieve it. Continuing on in the series on workflow automation, let’s turn our attention to Hazel.

This is the third article in a series on workflow automation. If you want to get caught up to this point, read the first and second articles.

What is Hazel?

Hazel is a System Preference pane that works silently in the background, automatically filing, organizing and cleaning.

Hazel Site

Hazel is an application that runs in your OS X System Preferences. It watches your files, providing functionality to perform several automation utilities, such as:

  • Automatically unzipping .zip files and trashing the .zip file
  • Renaming files that match a certain pattern
  • Moving outdated files to another folder
  • Running scripts against a file
  • Uploading certain files to an FTP server
  • Automatically emptying the Trash
  • Fully deleting applications when you move them to the Trash

This is a Mac-specific application, but there are similar applications on other operating systems.

Why use it?

All of the aforementioned uses are tedious and require a decent amount of mental thought. There’s no sense in wasting the time when it can be automated. Set it up once with Hazel, and it will take care of the rest.

Examples

Now let’s look at some examples of Hazel. I’ll show some of the various tasks that I have set up, and hopefully that gives you some guidance on how it can fit into your workflow.

Handle ZIP files

Why manually double-click a ZIP file and then immediately trash the file? This workflow handles it for me.

Within the ‘Downloads’ folder, if a file’s extension is .zip, unarchive it, and move the ZIP file to the trash.

Handle ZIP Files

Clean Desktop

I refuse to have anything on my Desktop. However, I do use it to quickly drop files that are automatically moved elsewhere with this workflow.

Within the ‘Desktop’ folder, if the file isn’t opened in the last hour (any file), move the file from the Desktop to the ‘Inbox’ folder.

Clean Desktop

Move old files

I don’t like my ‘Downloads’ folder to get messy. This workflow keeps it nice and tidy.

Within the ‘Inbox’ folder, if the file isn’t opened in the last 2 weeks, isn’t modified in the last 3 days, and isn’t a custom folder, move to the ‘To File’ folder.

Move old files

Upload file(s) to an FTP server

I have a set of curated GIFs that I upload to my own FTP server. This workflow automates that process.

Within the ‘To Upload’ folder, if the file extension is any image (.gif, .png, .jpg, .jpeg), upload to the FTP server, display a notification that the file was uploaded, run a shell script to copy the path to the system clipboard, and trash the file.

Upload files to FTP server

And here’s the embedded shell script used to copy the uploaded file URL to the system clipboard:

Embedded script

Note: As you can see, bin scripts can be triggered within a workflow. Be sure to read my previous article on bin scripts (wink wink).

That’s All, Folks

These are just a fraction of the ways that Hazel can help automate your workflow. Try and think of any manual file manipulation or modification that you do, and work on automating it with Hazel. It’s just another tool in the workflow-automation arsenal.

© 2019 Drew Barontini — Building products under Drewbio, LLC