Skip to main content

Script to automatically purge old trash

Project description

Autotrash is a small python script to automatically remove (permanently delete) trashed files. It relies on the Trash files for it's deletion information.

It scans the ~/.local/share/Trash/info directory and reads the .trashinfo files to determine their deletion date. Files older then 30 days or files matching a particular regular expression are then purged, including their trash information file.

Travis CI build status


On Fedora consider using yum install autotrash

On Arch Linux use the autotrash package in AUR

On Ubuntu and Debian try to install it using apt-get install autotrash.

Last option is to copy the autotrash file from a release to any location on your PATH, for example /usr/bin/.


It should be considered to be run as a crontab entry:

@daily /usr/bin/autotrash -d 30

You can also make autotrash process all user trash directories (not just in your home directory) by adding this crontab entry:

@daily /usr/bin/autotrash -td 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.


Autotrash is now in the stable repo for Fedora 20 and is going to be synced out on the mirrors also for Fedora 21. Epel7 package is still in the testing repo but should go stable within few days.

You can install the package on Fedora right now with: yum install autotrash

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for autotrash, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size autotrash-0.3.0-py2.py3-none-any.whl (20.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size autotrash-0.3.0.tar.gz (30.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page