Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

Whether you still call it Trash or Bin, it's the same concept - deleted files are not permanently deleted but are made inaccessible until you decide to permanently remove them. Sometimes this is a little bit bothersome, especially if you happen to be using your Mac as a media centre/HTPC. So here's how to set it up so that the Trash is emptied automatically at certain intervals and times.

Note if you are content with having the Trash emptied once every 30 days, you can do so from Finder preferences...
emptytrash_1.png


I wanted to remove unneeded files a bit more often, so here's how I did it...

Step 1 - Open the Script Editor application from the Applications/Utilities folder.
emptytrash_2.png


Step 2 - Enter the following code into the AppleScript editor and click the compile button (the hammer)...
 AppleScript
tell application "Finder"
set warns before emptying of trash to false
empty the trash
set warns before emptying of trash to true
end tell


Step 3 - Save your code as an Application called EmptyTrash somewhere convenient (e.g. the Documents folder)...
emptytrash_4.png




Step 4 - Open the Calendar application...
emptytrash_5.png


Step 5 - Create a new event at a convenient time (when your Mac is likely to be on) and in the alert field set it to Custom > Open File > Other, and select the EmptyTrash application you created earlier.
emptytrash_6.jpg


Step 6 - Set the repeat interval (I picked every day). You can also create a new calendar and place this event there, then hide the calendar if you do not want this event to appear all over the place. I didn't do this because my Mac is only used as a media centre.
emptytrash_7.png


Once all that is done, your Mac's Trash will be emptied automatically at the time you set (assuming the Mac is on).

-I

Skip down to comments...
A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. If you spot something out of place, please do let me know.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
 
comments powered by Disqus
Other posts you may like...