Just like in the physical world, it's easy to let digital clutter accumulate on your Mac: in fact, right now your Downloads Stack is filled with no-longer relevant files and your Desktop is covered in documents you finished with last week. The Windows Janitor cleans out files of a certain age from a given folder on PCs, but Mac users have an even more robust, graphical alternative: the automated, rules-based file manager Hazel. Let's take a closer look at how Hazel can keep your Mac's hard drive free of files you don't need anymore.
Download a 14-day free trial of Hazel 2 here. (A license costs $22.)
Empty Your Downloads Folder with Hazel
Once you've installed Hazel, go to its pane in System Preferences (it will be listed under the "Other" heading). To add a new folder rule, click on the + button under the Folder list, and choose a folder, like "Downloads," to add it to the list. Select it, and then to create a new rules-based action, click on the + button under the Rules box. Here you can set up automatic actions based on file criteria, much like iTunes Smart Playlists, as shown.
Think of Hazel's rules like email filters: They work according to simple if-then logic. The rule pictured above says that if a file in the Downloads folder was added (that is, downloaded and saved there) more than four weeks ago, Hazel should delete it. When Hazel is running, it will automatically recover space in your Downloads folder occupied by files you saved more than four weeks ago.
File Away Screengrabs
You can use similar rules on any folders you use as temporary workspaces to keep them clean and tidy. For example, if you take screenshots using Cmd+Shift+3/4, you'll get a .PNG file saved to your desktop right away. You can set up Hazel to automatically move those files off the desktop to a "screenshots" folder, like this:
Test Your Rule Matches
While you construct and experiment with rules, you may want to see what files would match the criteria. To do so, from the drop-down below the Rules area, choose "Preview Rule Matches." For the screenshots rule, the results look like:
Take Out the Trash with Hazel
Hazel can also automatically manage your Mac's Trash bin, so you don't have to empty it by hand, or worry that the files there are taking up too much space on your hard drive. In Hazel's System Preferences pane, go to the Trash tab. There you can set Hazel to automatically delete files that have been sitting in the Trash for more than a certain amount of time, and/or set it to keep the total size of the Trash under a certain file size, as shown.
Also in the Trash tab, you can enable Hazel's "App Sweep" feature, which monitors the applications installed on your Mac and the related settings and files it adds to your system. When you delete a program? Hazel will prompt you to delete any related files that application would otherwise leave behind.
More Automatic File Processing
Hazel can do much more than just delete old files. Experiment with its rich criteria options and possible actions to see what's useful for you. To see some examples, from the drop-down beneath the Rules area, choose "Load Sample Rules."
With Hazel you can:
Automatically move media files like MP3's, videos, or photos to your iTunes library or iPhoto library, as shown:
This works well if you've got scheduled music/movie downloads going on with a utility like wget.
Automatically sort images (like photos imported from your camera) into subfolders named by date, as shown.
Label or keyword any file based on any rule (like added in the last hour, for example).
Run a custom Automator workflow or AppleScript on the items in a folder (like image resizing, for example.)
Now all we need is Hazel for Windows. Any Hazel users out there have killer rules for keeping their Mac clean and tidy? Share 'em in the comments.
Gina Trapani, the editor of Lifehacker, considers Hazel the software equivalent of the Roomba. Her weekly feature, Geek to Live, appears every Friday on Lifehacker. Subscribe to the Geek to Live feed to get new installments in your newsreader.