The trash (or "Recycle bin") is a sane concept of our operating systems. A file sent to the trash can be recovered if the user realizes the file was still needed after all. Now, the problem is: when should you empty the trash?
Linux users, rejoice! Enter Autotrash. The name may sound a little scary, but this tiny command-line Python application is actually very friendly and fully solves the problems I just exposed. Its humble task is to selectively purge your trash based on certain criteria that you specify, like Deletion date, Remaining disk space, or Regular expressions.
Edit 2010/04/14: Windows users, Martin found a great app for you, read his followup article.
For example, you can tell Autotrash to delete files that have been in the trash for more than 7 days ago, and to ensure that at least 10GB remain available:
This means our three problems are solved:
The next question you'll probably ask is: "Great, but I don't want to have to run Autotrash manually, how do I setup a schedule?". In typical GNU style, Autotrash doesn't do that, and it's okay because it's not its job. To do the scheduling, I suggest that:
The most straightforward way to install Autotrash on an Ubuntu machine is to use its PPA. Inside a terminal, enter:
sudo add-apt-repository ppa:bneijt/ppa && sudo apt-get update && sudo apt-get install autotrash
Once the installation is done, open the manual page to see what it can do, and do your own setup:
man autotrash
Autotrash is free software licensed under the GPLv3, currently available as source or Ubuntu PPA. Special thanks to nekohayo who made me discover it.
Ronan is a geek and musician living in Montreal. He enjoys days when his hard drive doesn't evaporate because of an accidental keystroke and rambles about software, music and life at flying molehill.
AdvertisementPlease click on the following link to open the newsletter signup page: Ghacks Newsletter Sign up
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.
One small tweak to the install to get it working: you need to do a ‘sudo apt-get update’ between adding the PPA & install autotrash.
Thanks for reviewing a handy little utility! I look forward to using it.
Thanks Lance, I fixed it.
Feel free to share your Autotrash tips here once you’ve used it a bit.