autotrash is a neat little program to automatically empty old files from your Linux desktop trash bin. The program looks at the content of your your “Desktop” Trash folder and automatically deletes part of it according to the given parameters. In particual I find the following two options interesting:
autotrash [-d purge_n_days_old] autotrash [–delete number_of_megabytes_to_purge]
The first one (
-d) deletes everything which is older than X days. This is probably the most used option for most users.
The second one (
-delete) removes at least X MB worth of storage space from the trash, starting with the oldest one.
The program provides some more advanced options for fine-tuning and more examples can be found in the man page.
I use this program to continuously purge old files from the trash bin via a cron job, which removes files older than 30 days every hour:
# Purge files older than 30 days every hour 0 * * * * autotrash -d 30 2>/dev/null
Every hour might be overkill, but so far I have not noticed it and it helps me to do one more thing fully automated in the background. Nice!