Emptying the trash automatically

Christopher Breen
14 February, 2012
View more articles fromthe author

Reader Collin Merrill would like to automate a common, but potentially risky, task on his Mac. He writes:

I was just wondering if you had an Automator workflow to automatically empty the trash. I’m fairly new to a Mac, and have almost no experience with Automator.

As you’ve likely noticed, while there is an Automator action for moving items to the trash (found in the Files & Folders area), there’s no specific action for then emptying the trash. And that’s a wise move on Apple’s part as having such an action might lead to “Oh wait, I didn’t mean to delete that!” situations.

But Automator’s savvy designers have provided a workaround for things like this. And that workaround is AppleScript. While you may not be able to access an Apple-created Empty Trash action, you can build an AppleScript that accomplishes this task that’s included as part of your workflow. I’ll demonstrate by creating a workflow that only empties the trash when executed.

Launch Automator, choose the kind of workflow you want to create (in this case let’s choose an Application workflow), and in the resulting window select the Utilities entry in Automator’s first column and drag the Run AppleScript action to the workflow area to the right.

Highlight the text that reads (* You script goes here *) and enter:

tell application "Finder" 
empty the trash 
end tell

The entire content of that Run AppleScript action should now look like this:

Save your workflow to the desktop. Be sure there’s something in the trash (and that you really want to empty the trash) and then double-click on your workflow to execute it. The trash will empty.

And that’s the idea. When you can’t find a way to accomplish one task or another with Automator’s default tools, it’s possible that you can do the job with AppleScript.


2 people were compelled to have their say. We encourage you to do the same..

  1. steven says:

    Or just go to the Finder menu and click Empty Trash. LOL. Kinda pointless.
    Or hit Command-Shift-Delete (or Command-Shift-Option-Delete if you don’t want the prompt).

  2. Oliver says:

    I found a quite helpful little app called TrashTimer (http://www.hieper.nl/html/trashtimer.html).

    It is a simple preference panel which can automatically remove individual items from the trash. When you use TrashTimer, items which are moved into the trash will be automatically deleted after a user specified period of time…

Leave a Comment

Please keep your comments friendly on the topic.

Contact us