Automate your Mac: three smart hacks for managing files
By Brett Terpstra, Matt Gemmell
Managing files and folders is one of the most obvious—and easiest—chores to automate on your Mac, thanks to specialized tools like Hazel, as well as generalists like AppleScript, Automator, and Keyboard Maestro.
Clear the desktop
Getting public Dropbox link for selected file
Tool: Keyboard Maestro
I often want to quickly share a selected file in the Finder via Dropbox, by moving that file to my Dropbox’s Public folder and then obtaining the Dropbox link to the uploaded copy. So I created a Keyboard Maestro macro to automate the process. Yes, you can do this with the Dropbox Mac app, but that requires first moving the file into your Dropbox folder, then using the Dropbox menubar icon (or the Dropbox Web interface) to obtain the link. There are also some other third-party utilities that’ll collect Dropbox links, but I like the flexibility Keyboard Maestro gives to, say, chain multiple macros together—for example, so with one macro I can take a screenshot of the frontmost window then automatically put it in Dropbox.
The first step selects the file, using the For Each action, specifying Path in the For Each drop-down and adding the collection The Finder’s Selection. There follow four actions: Move (or Rename the File (opting to move the file %Variable%Path% to the folder ~/Dropbox/Public); Filter Variable to obtain just the filename (selecting the variable Path from the drop-down and Last Path Component from With); copying the Dropbox path to the clipboard with Set Clipboard to Text (setting Set to System Clipboard and To to Plain Text, then entering the path to your public Dropbox folder, followed by %Variable%Path%); and, finally, Notification (with the title Dropbox link copied, the message set to the token Current Clipboard).
Note that, for that third action, you can get the base URL for your Dropbox’s Public folder by putting a file into your Public folder and then using either the Dropbox menubar icon or the Web interface to get a sharing link. Strip off the filename part at the end, and you’ve got your own unique base link to use in the macro.—Matt Gemmell
Tag files by age
To do all this tagging, I created a series of Hazel rules, based on the Last Modified date. The Green rule looks for files created that day and applies the green tag to them. The Orange rule looks for files tagged green that haven’t been modified within the last 2 days and tags them orange. Red looks for orange- or green-tagged files unmodified in the last week and retags them accordingly. And the Archive task looks for any file not colored Blue that has been sitting unmodified for over 2 weeks.—Brett Terpstra
[Updated 11:00 am PT 9/1/14 to remove a tip re: showing the Library folder.]
Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read ouraffiliate link policyfor more details.