Autotrash – Automatically take-out the trash

Sponsored Link
Autotrash is a simple Python script which will purge files from your trash based on their age or the amount of free space left on the device. Using autotrash -d 30 will delete files which have been in the trash for more then 30 days. It uses the FreeDesktop.org Trash Info files included in the new GNOME system to find the correct files and the dates they where deleted.
It scans the ~/.local/share/Trash/info directory and reads the .trashinfo files to determine their deletion date. Files older then 30 days are then removed including their trash information file.

Features:

* Remove files that are older then a given number of days (see the -d option)
* Purge older files to ensure a specific amount of disk space is free (see the --min-free option)
* Check for remaining disk space, and only delete if you are running out (see the --max-free option)
* Delete regex matching files first (see --delete-frist option)

Install autotrash in ubuntu 10.04/9.10

Open the terminal and run the following commands

sudo add-apt-repository ppa:bneijt/ppa

sudo apt-get update

sudo apt-get install autotrash

Using autotrash

It should be considered to be run as a crontab:

@daily  /usr/bin/autotrash -d 30

Or more frequently, but to keep disk IO down, only when there is less then 3GB of free space:

@hourly /usr/bin/autotrash --max-free 3072 -d 30

To configure this, run "crontab -e" and add one of these lines in the editor, then save and close the file.

If you do not know how to work with crontab, you could add it to the startup

programs in GNOME using the menu: System -> Preferences -> Sessions

Add the program with the "+ Add" button.

This will make sure that your trash is cleaned up every time you log in.

Sponsored Link

You may also like...

1 Response

  1. You can achieve pretty much the same thing with trash-cli, and trash-cli is in the main repos:
    http://marius.scurtescu.com/2009/05/05/control_your_trash

    Marius

Leave a Reply

Your email address will not be published. Required fields are marked *