1AUTOTRASH(1) General Commands Manual AUTOTRASH(1)
2
3
4
6 autotrash — program to automatically purge old files from the FreeDesk‐
7 top.org trash
8
10 autotrash [-d purge_n_days_old]
11
12 autotrash [--delete number_of_megabytes_to_purge]
13
14 autotrash [--keep-free number_of_megabytes_to_free]
15
17 autotrash is a program that looks in a FreeDesktop.org Trash folder for
18 information on it's contents and then purges a part of the trash
19 depending on the options.
20
21 The most common option is -d, which will purge files that have been in
22 the trash for more then a given number of days.
23
24 The option --delete will remove at least the given number of megabytes
25 from the trash, removing the oldest trash first.
26
27 Using --keep-free will make sure at least the given number of megabytes
28 of free space is available, by automatically setting --delete to the
29 right value. For example, to keep at least a 1GB of free space, remov‐
30 ing files from the trash if needed, use autotrash --keep-free 1024 .
31
33 This program follows the usual GNU command line syntax, with long
34 options starting with two dashes (`-').
35
36 -h --help Show a summary of options.
37
38 -d DAYS --days DAYS
39 Purge files older than DAYS number of days.
40
41 -T PATH --trash-path PATH
42 Use the given path as the location of the Trash directory,
43 instead of the default: ~/.local/share/Trash .
44
45 --max-free M
46 Only purge files if there is less than M megabytes of free
47 space left at the trash location. As an example, if you set
48 this to 1024, then autotrash will only start to work if there
49 is less than 1GB of free space in the trash. Till that time,
50 autotrash will just exit normally without scanning the Trash
51 directory. If unsure, try running autotrash with --dry-run
52 and --verbose to see the effect.
53
54 --delete M
55 Purge at least M megabytes, deleting oldest trash addition
56 first. It uses trash entries, NOT individual files. This
57 means that if your oldest trashed item is a 1GB directory,
58 and you request at least 10MB to be removed (M=10), autotrash
59 will remove 1GB. If unsure, try running autotrash with both
60 --dry-run and --stat to see the effect.
61
62 --min-free M --keep-free M
63 Make sure there is a minimum of M megabytes of free space. If
64 there is less free space, set --delete to the difference
65 between M and the amount of free space. If unsure, try run‐
66 ning autotrash with --dry-run and --verbose to see the
67 effect.
68
69 -D REGEX --delete-first REGEX
70 Purge any file which matches REGEX first, regardless of it's
71 time-stamp. REGEX must be a valid regular expression. If this
72 option is used multiple times, the files matching the first
73 regular expression are deleted first, then the second etc.
74 Example, delete any *.avi files first, then by age: --delete-
75 first '.*\.avi'
76
77 -v --verbose
78 Output information on what is happening and why.
79
80 -q --quiet
81 Only output warnings.
82
83 --check Report .trashinfo files that point to a non-existing file.
84 This will only happen with a broken Trashcan. It is left up
85 to the user to actually do something with this information.
86 These files will be removed as soon as the mentioned file
87 would be removed by autotrash.
88
89 --dry-run Only list what would be done, but actually do nothing.
90
91 --stat Show the number, and total size of files involved.
92
93 -V --version
94 Show the version of program.
95
97 Examples of program use.
98
99 autotrash -d 30
100 Purge any file that has been in the trash for more then 30
101 days.
102
103 autotrash --max-free 1024 -d 30
104 Only purge files from the trash if there is less than 1GB of
105 space left on the trash filesystem. If so, only trash files
106 that are older than 30 days.
107
108 autotrash --min-free 2048
109 Purge files from trash, oldest first, till there is at least
110 2GB of space on the trash filesystem. There is no restriction
111 on how old trashed files are.
112
113 autotrash --min-free 2048 -D '.*\.bak' -D '.*\.avi'
114 Purge files from trash till there is at least 2GB of space on
115 the trash filesystem. If we need to remove files, make sure
116 we remove *.bak files first, then all *.avi files and after
117 that the oldest to the newest. There is no restriction on how
118 old trashed files can get. Please note that '.*\.bak' and
119 '.*\.avi' are regular expressions and not glob patterns.
120 Given that they are regular expressions, using -D
121 '.*\.(png|gif|jpg|jpeg)' will match images with any of the
122 given extensions.
123
124 autotrash --max-free 4000 --min-free 2048 -d 30
125 Start reading the trash if there is less than 4000MB of free
126 space, then start keeping an eye on. At that point, remove
127 files older than 30 days and if there is less than 2GB of
128 free space after that remove even newer files.
129
130 @hourly /usr/bin/autotrash --max-free 4000 --min-free 2048 -d 30
131 Experienced users should consider adding autotrash as a
132 crontab entry, using crontab -e and adding the line above.
133
135 This manual page was written by A. Bram Neijt bram@neijt.nl for the
136 Debian system (and may be used by others). Permission is granted to
137 copy, distribute and/or modify this document under the terms of the GNU
138 General Public License, Version 3 or any later version published by the
139 Free Software Foundation.
140
141
142 On Debian systems, the complete text of the GNU General Public License
143 can be found in /usr/share/common-licenses/GPL.
144
145
146
147
148 AUTOTRASH(1)