Package: autotrash
Autotrash is a small python script to automatically remove
(permanently delete) trashed files. It relies on theFreeDesktop.org
Trash filesfor it's deletion information.
It should work for most modern desktops, including KDE and GNOME.It scans the~/.local/share/Trash/infodirectory and reads the.trashinfofiles 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.InstallationThere are mulitple ways to install the software. Either using your Linux distribution package manager (if a package is available) or using the Python package directly.Using a distribution package is preferred as it will also ensure that autotrash is updated during your regular updates, however not all distributions have autotrash available as a package, so you may need ot use python directly anyway.Using the a package manager:On Fedora consider usingyum install autotrashOn Ubuntu and Debian, usingpipx:sudo apt-get install pipx
pipx install autotrashOn ArchLinux, there is anAUR package availableFinally you could try usingpipdirectly ifpipxis not available.ConfigurationYou need to run autotrash to have it inspect your trash and start deleting old files.
You can always run it manually, but most of the time you want to have it run scheduled in the background.Automatic setup with systemdRunautotrash --installto create a systemd service which runs daily with the provided arguments. For exampleautotrash -d 30 --installwill run/usr/bin/autotrash -d 30every day.After installing this installation, the service can also be manually started withsystemctl --user start autotrash.The timer can be enabled and disabled usingsystemctl --user enable autotrash.timerandsystemctl --user disable autotrash.timerrespectively.The service is installed to~/.config/systemd/userso like the cron approach, root access is not required and multiple users have their own independent services.Manual cron setupTo run autotrash daily using cron, add the following crontab entry:@daily /usr/bin/autotrash -d 30You can also makeautotrashprocess all user trash directories (not just in your home directory) by adding this crontab entry:@daily /usr/bin/autotrash -td 30Or 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 30To configure this, run "crontab -e" and add one of these lines in the
editor, then save and close the file.System startup setupIf you do not know how to work with crontab, you could add it to the startup
programs in GNOME using the menu: System -> Preferences -> SessionsAdd the program with the "+ Add" button.This will make sure that your trash is cleaned up every time you log in.~/.gnomercYou can create a script thats run at login to Gnome:~/.gnomerc. One advantage to this method is ability to have different rules for various trash folders. For example:#!/bin/bash
# Empty homedir trash
autotrash --days 30 --trash-path=~/.local/share/Trash
# Empty trash for non-home folders:
autotrash --days 10 --trash-path=/dpool/vcmain/.Trash-`id -u`
autotrash --days 15 --trash-path=/dpool/vccorp/.Trash-`id -u`General informationHomepage:https://github.com/bneijt/autotrashAutotrash 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 autotrashDevelopmentTheautotrashcommand is created as a script, usingpoetryyou can run the current implementation using:poetry run autotrashOr by using the shell:poetry shell
autotrash --helpAll pull requests and master builds are tested using github actions and requireblackformatting.