Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to be able to utilize such a shortcut without having to actually be in Finder looking at the folder whose contents I want to delete. For example, I could be surfing the 'net and suddenly decide that I want to delete all the contents of my "downloaded pictures" folder, so I just click a shortcut key, or set of keys (Shift+Command+Space bar, or whatever) and the files are moved to the trash.


I'm using OS X 10.6.2.

share|improve this question

You can write a shell script in Automator and then use a Quicksilver trigger to bind it to a hotkey.

share|improve this answer

I would (almost) go with etlovett's solution. Here's a script that would do the job (in Terminal):

#! /bin/bash

rm -r /...[complete path to folder]
mkdir /...[complete path to folder]

First line removes the directory, second line creates it again, but empty. Save the script somewhere, and then in Terminal:

chmod +x /...[complete path to script]

You are going to end up with a nice little Unix Executable, that you can just double-click.


share|improve this answer
By the way, this script won't put your files in the Trash, but remove them forever-ever. – trolle3000 Feb 5 '10 at 0:06
rm -rf /Users/your_username/Downloads/* will delete the contents of a folder (and the contents of any folders in that folder) but will leave the Downloads folder intact. The automator action Run Shell Script will let you save it as an automator app, which can then be opened in numerous ways. If you want to save the script for double clicking and avoid automator save it with the extension .command instead of .sh – ridogi Feb 5 '10 at 1:28
@ridogi, that doesn't remove hidden files. Removing the directory entirely and then creating it again will do that. – trolle3000 Feb 5 '10 at 2:00
True, but adding a second line rm -rf .* /Users/your_username/Downloads/ would solve that if removing hidden files is actually necessary. I suggested it because deleting the folder could cause other side effects—perhaps an application would get confused if it's assigned downloads folder goes missing. Your method will work too, just providing an alternative method. – ridogi Feb 5 '10 at 4:45
Well, didn't know that one ;-) Then we have to solutions. – trolle3000 Feb 5 '10 at 17:42

You must log in to answer this question.