Automate your Mac: three smart hacks for managing files
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
I’m one of those people who litters his desktop with files throughout the day. I’ve created an Automator workflow that moves these files to a Desktop Moved folder I’ve created within my Documents folder. To create, I opened Automator, and selected Calendar Alarm as the type of document. I then added the following actions, in order: Get Specified Finder Items (adding my Desktop folder to its list); Get Folder Contents; Move Finder Items (specifying my Desktop Moved folder as the target). I set up this alarm to go off every Sunday at 5:00 p.m., so I can start my work week the next morning with a clean desktop.—Christopher Breen
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
I use my Desktop as my primary inbox: When I save a new file, it goes straight to my Desktop. Then, at the end of the day, I review it, tagging and moving files as necessary. I use Hazel to make this easier, by having it color-code files according to how old they are. Specifically, I mark brand new files with green tags. When those files are two-days old, I swap in an orange tag. After one week on the Desktop, files get a red tag. Any red files that sit for more than two weeks get automatically moved to an archive folder, which I revisit monthly, unless I’ve manually applied a blue “protect” tag.
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.]