path

age

Tidy files whose age is equal to or greater than
the specified time. You can choose seconds, minutes,
hours, days, or weeks by specifying the first letter of any
of those words (for example, ‘1w’ represents one week).

matches

One or more (shell type) file glob patterns, which restrict
the list of files to be tidied to those whose basenames match
at least one of the patterns specified. Multiple patterns can
be specified using an array.

This removes files from /tmp if they are one week old or older,
are not in a subdirectory and match one of the shell globs given.

Note that the patterns are matched against the basename of each
file – that is, your glob patterns should not have any ‘/’
characters in them, since you are only specifying against the last
bit of the file.

Finally, note that you must now specify a non-zero/non-false value
for recurse if matches is used, as matches only apply to files found
by recursion (there’s no reason to use static patterns match against
a statically determined path). Requiring explicit recursion clears
up a common source of confusion.

recurse

rmdirs

Tidy directories in addition to files; that is, remove
directories whose age is older than the specified criteria.
This will only remove empty directories, so all contained
files must also be tidied before a directory gets removed.

size

Tidy files whose size is equal to or greater than
the specified size. Unqualified values are in kilobytes, but
b, k, m, g, and t can be appended to specify bytes,
kilobytes, megabytes, gigabytes, and terabytes, respectively.
Only the first character is significant, so the full word can also
be used.