File autotrash.1 of Package autotrash
.\" Automatically generated by Pandoc 2.13
.\"
.TH "AUTOTRASH" "1" "" "" ""
.hy
.SH NAME
.PP
autotrash \[em] program to automatically purge old files from the
FreeDesktop.org trash
.SH SYNOPSIS
.PP
\f[B]autotrash\f[R] [\f[B]-d\f[R] purge_n_days_old]
.PP
\f[B]autotrash\f[R] [\f[B]\[en]delete\f[R] number_of_megabytes_to_purge]
.PP
\f[B]autotrash\f[R] [\f[B]\[en]keep-free\f[R]
number_of_megabytes_to_free]
.SH DESCRIPTION
.PP
\f[B]autotrash\f[R] is a program that looks in a FreeDesktop.org Trash
folder for information on it\[cq]s contents and then purges a part of
the trash depending on the options.
.PP
The most common option is \f[B]-d\f[R], which will purge files that have
been in the trash for more then a given number of days.
.PP
The option \f[B]\[en]delete\f[R] will remove at least the given number
of megabytes from the trash, removing the oldest trash first.
.PP
Using \f[B]\[en]keep-free\f[R] will make sure at least the given number
of megabytes of free space is available, by automatically setting
\f[B]\[en]delete\f[R] to the right value.
For example, to keep at least a 1GB of free space, removing files from
the trash if needed, use \f[B]autotrash \[en]keep-free 1024\f[R] .
.SH OPTIONS
.PP
This program follows the usual GNU command line syntax, with long
options starting with two dashes (\[ga]-\[cq]).
.TP
-h \[en]help
Show a summary of options.
.TP
-d \f[I]DAYS\f[R] \[en]days \f[I]DAYS\f[R]
Purge files older than DAYS number of days.
.TP
-T \f[I]PATH\f[R] \[en]trash-path \f[I]PATH\f[R]
Use the given path as the location of the Trash directory, instead of
the default: \[ti]/.local/share/Trash .
.TP
\[en]max-free \f[I]M\f[R]
Only purge files if there is less than \f[I]M\f[R] megabytes of free
space left at the trash location.
As an example, if you set this to 1024, then autotrash will only start
to work if there is less than 1GB of free space in the trash.
Till that time, autotrash will just exit normally without scanning the
Trash directory.
If unsure, try running autotrash with \f[B]\[en]dry-run\f[R] and
\f[B]\[en]verbose\f[R] to see the effect.
.TP
\[en]delete \f[I]M\f[R]
Purge at least \f[I]M\f[R] megabytes, deleting oldest trash addition
first.
It uses trash entries, NOT individual files.
This means that if your oldest trashed item is a 1GB directory, and you
request at least 10MB to be removed (\f[I]M\f[R]=10), autotrash will
remove 1GB.
If unsure, try run\[hy] ning autotrash with both \f[B]\[en]dry-run\f[R]
and \f[B]\[en]stat\f[R] to see the effect.
.TP
\[en]min-free \f[I]M\f[R] \[en]keep-free \f[I]M\f[R]
Make sure there is a minimum of \f[I]M\f[R] megabytes of free space.
If there is less free space, set \[en]delete to the difference between
\f[I]M\f[R] and the amount of free space.
If unsure, try running autotrash with \[en]dry-run and \[en]verbose to
see the effect.
.TP
-D \f[I]REGEX\f[R] \[en]delete-first \f[I]REGEX\f[R]
Purge any file which matches \f[I]REGEX\f[R] first, regardless of
it\[cq]s time-stamp.
REGEX must be a valid regular expression.
If this option is used multiple times, the files matching the first
regular expression are deleted first, then the second etc.
.RS
.PP
Example: delete any .avi files first, then by age:
\f[B]\[en]delete-first `.*\[rs].avi'\f[R]
.RE
.TP
-v \[en]verbose
Output information on what is happening and why.
.TP
-q \[en]quiet
Only output warnings.
.TP
\[en]check
Report .trashinfo files that point to a non-existing file.
This will only happen with a bro\[hy] ken Trashcan.
It is left up to the user to actually do something with this
information.
These files will be removed as soon as the mentioned file would be
removed by autotrash.
.TP
\[en]dry-run
Only list what would be done, but actually do nothing.
.TP
\[en]stat
Show the number, and total size of files involved.
.TP
-V \[en]version
Show the version of program.
.PP
The exit status of \f[B]autotrash\f[R] will be 1 if a corrupt trashinfo
file is found.
.SH EXAMPLES
.PP
Examples of program use.
.TP
autotrash -d 30
Purge any file that has been in the trash for more then 30 days.
.TP
autotrash \[en]max-free 1024 -d 30
Only purge files from the trash if there is less than 1GB of space left
on the trash filesystem.
If so, only trash files that are older than 30 days.
.TP
autotrash \[en]min-free 2048
Purge files from trash, oldest first, till there is at least 2GB of
space on the trash filesystem.
There is no restriction on how old trashed files are.
.TP
autotrash \[en]min-free 2048 -D `.*\[rs]\[rs].bak' -D `.*\[rs]\[rs].avi'
Purge files from trash till there is at least 2GB of space on the trash
filesystem.
If we need to remove files, make sure we remove \f[I].bak files first,
then all \f[R].avi files and after that the oldest to the newest.
There is no restriction on how old trashed files can get.
Please note that `.*\[rs].bak' and `.*\[rs].avi' are regular expressions
and not glob patterns.
Given that they are regular expressions, using -D
`.*\[rs].(png|gif|jpg|jpeg)' will match images with any of the given
extensions.
.TP
autotrash \[en]max-free 4000 \[en]min-free 2048 -d 30
Start reading the trash if there is less than 4000MB of free space, then
start keeping an eye on it.
At that point, remove files older than 30 days and if there is less than
2GB of free space after that remove even newer files.
.TP
\[at]hourly /usr/bin/autotrash \[en]max-free 4000 \[en]min-free 2048 -d 30
Experienced users should consider adding autotrash as a crontab entry,
using \f[B]crontab -e\f[R] and adding the line above.
.SH COPYING
.PP
Copyright \[co] 2015 Bram Neijt <bneijt@gmail.com>
.PP
This manual page was written for the \f[B]Debian\f[R] system (and may be
used by others).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License, Version 3 or any
later version published by the Free Software Foundation.
.PP
On Debian systems, the complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL.
.SH AUTHORS
A. Bram Neijt <bneijt@gmail.com>.