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:
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.
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
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.