cleaner.sh
is a script to keep a finite number of backup (files) matching a
pattern. It should be scheduled on a regular basis from the outside, e.g. with
cron
.
cleaner.sh
takes a number of single or double-dashed options, followed with
the patterns/files to clean from. It is possible to separate the list of options
from the destinations using a single double-dash, to mark the definitive end of
the options. This enables to point at paths which would start with a dash sign
(unlikely!).
The following options are recognised.
The value of this option should be the number of files to keep. It defaults to an empty string, which is understood as keeping all the files.
The value of this option is a command that will be evaluated once the removal operations have ended. It defaults to an empty string.
When this option is given, verbosity will be increased.
This utility is tuned for maximal compatibility. It only requires a basic POSIX
shell. As a result, cleaner.sh
can easilty be used from containers or in
embedded systems.