Organizing your Downloads folder; or, building a personal assistant that doesn't smell like solder and sadness.
By default, web browsers on OS X like to stuff whatever porn files you save into the Downloads folder. It's a smart practice for the first week or so, until the folder is probably filled with hundreds of porn files. Go ahead, have fun trying to find that Sasha Grey very important PDF you downloaded last week: I'll be waiting.
Eventually, the Downloads folder clutter will take its physical and emotional toll on you. Just like porn.
So what have I done about it? I'm ecstatic you asked. As they say, a clean folder is a clean mind (as well as the lesser known, a dirty....yeah).
tl;dr I set up a folder action that routes recently downloaded files to subfolders within the Downloads folder.
Here's what it ends up looking like. Pretty zen, right?
So let's get to it. First, find your Downloads folder in Finder. Right click it and select "Folder Actions Setup"
You should be greeted by a pleasant popup with a number of default scripts. Choose "add - new item alert.scpt".
Check off "Enable Folder Actions" in the upper left corner!
Then select the script and click "Edit Script".
The AppleScript editor will appear. Here's the code you'll want to use (adjust the directories and paths as necessary):Feel free to filter by more criteria. Also note that you can move the files to any arbtirary path, including outside of the Downloads folder, so long as it's properly assigned to a variable.
Save the file and exit the Folder Actions setup.
It'll take about 3 to 5 seconds for Finder to register a newly added file, but you'll know it's done when it plays the familiar copy+paste sound.
And now, even if your mind is dirty, your Downloads folder will be clean.
EDIT: Justin pointed out in the comments that it might be handy to make this go ahead and sort all of your current items in Downloads. Add this bit of code between all of the property declarations and the "on adding..." part:
Make sure you declare the Downloads property with the colon at the end.
Hit the "Run" button in the AppleScript editor and it'll go ahead and organize your folder.

