How to: Empty Downloads folder with AppleScript

“Cleanliness is next to godliness” or so the saying goes. If that’s true, getting the work done automagically with a cleverly crafted AppleScript must be a sure ticket to Mount Olympus residency. Here’s a little script to flush your Downloads folder.
A few weeks back, I authored Tip: Keep your Downloads folder clean and mused out loud that an AppleScript for the task might exist. Well, the lads at OS X Hints just published one:
try
tell application “Finder”
move (files of alias “Macintosh HD:Users:YOURUSERNAMEGOESHERE:Downloads” whose name is not “Clear Downloads.app”) to trash
end tell
on error — oops, couldn’t move the file
display dialog (“Error”) buttons {“OK”}
end try
I can verify that this AppleScript performs admirably — just the stuff for the compulsively clean.
Have handy tip or AppleScript? Share your story and a link in the comments below…




Leave your response!