Like so many other Mac users, I am guilty of saving files to the Desktop. The shortcut (CMND+D) is so much easier than selecting a folder from the sidebar! Which saves me so much time – ALL the time – time I’m able to use to go back and organize the files sitting on the Desktop.
Except, not so much. The reality is that by the time I get around to organizing those files, I’ve mostly forgotten their original purpose. And I hope you weren’t expecting me to keep a list of any graphics files that might link to Desktop files, because there’s no way I’m going back to correct those links until it’s an issue.
Er… I think you can see the issue with saving files to the Desktop. Whether you believe files sitting on the Desktop really do slow your computer down, or you’re also finding that the Desktop is a less than ideal Inbox, automation is here to help!
Hazel is an automation app that sits in your Mac’s System Preferences. The beauty of this app is that it simplifies the sometimes daunting power of Automator, and it does this by allowing you to create a series of rules that it applies to folders you instruct it to monitor.
Keeping your Desktop clean with Hazel is as simple as five steps:
- Add the Desktop folder to Hazel.
- Add a new rule to the Desktop folder.
- Set the first criteria drop down to Any File, since you want all files on the Desktop to be moved.
- Under Do the following… set the action drop down menu to Move, then select the folder you want all Desktop files moved to from within the newly prompted drop down menu.
- Select Ok.
Conversely, there may actually be specific files that you want to always stay on the Desktop, such as alias folders. Protecting these files is as easy as ensuring that the very top drop down menu in Hazel is set to All, then add a new criteria rule that specifies Kind with the condition is not and the file type Alias (see figure above for reference). This additional step simply tells Hazel to look for any file that is not an alias file, and that file is the one to which the action will apply.
For my purposes, I have created an Inbox folder inside my user folder, and that is where Hazel moves all my Desktop files. Hazel then monitors the Inbox for additional rules, such as moving all image files into a specific folder, or grouping similarly named PDFs into particular folders, etc.
I’ll share what my Inbox folder’s rules look like in the future, but for now feel free to download my Desktop’s Hazel rule for convenience.
The same effect can also be reached by utilizing Automator’s built in Folder Action capabilities, though it requires a few more steps than Hazel.
Follow the steps below to replicate the Hazel rule created above, or scroll down to download the Automator script*:
- Open the Automator app (shortcut: CMND+SPACE+Automator+Enter), and select New Document from the menu prompt.
- Select Folder Action as your new document type.
- Within the new Automator window, specify Desktop from the top drop down menu – this tells your Mac which folder to monitor for file/folder changes. Now add the following actions from the menu options in the left sidebar (use the search bar to quickly navigate action options):
- Add Find Finder Items, then specify the Desktop folder from the Search dropdown menu. Here, you can specify the types of files you want Automator to move – or not move. I instructed Automator to find all files except alias files/folders.
- Add Move Finder Items, then specify the new folder you wish to house files saved to the Desktop folder from the To dropdown menu.
- Save your script (shortcut: CMND+S).**
- Technically we should be able to stop here, since our very first step instructed Automator to monitor the Desktop folder; however, Automator does not always perform properly during a script’s first run.
- To ensure that our script does work, direct your Finder window to the Desktop folder.
- Enable the secondary menu (shortcut: CTRL+select) and hover over the Services option.
- Select Folder Actions Setup….
- Within the newly prompted Folder Actions Setup window, follow these final steps to ensure your new Automator script runs indefinitely:
- Ensure that Enable Folder Actions is checked at the top.
- Select the left + button to add the Desktop folder to the left area – telling your Mac to monitor the Desktop folder.
- Finally, select the right + button to add your newly created Automator script to the right area – telling your Mac to apply the script to your Desktop folder.
- * If you download the Automator script, move the script to the path below and then complete all steps beginning from Step 4.
- ** You can find the saved Automator script at: ~/Library/Workflows/Applications/Folder Actions/