Name
rmold — remove old files and directories
Synopsis
rmold [
-anprv
] {
-m
MAX-AGE
} [PATH...]
Description
rmold searches each directory given on the command line for files and directories older than the specified time, and erases them.
Options
-a,--allAlso delete hidden files; if
-ris specified, also recurse into hidden directories.-m,--max-age=MAX-AGEDelete files and directories older than
MAX-AGEdays. This option is required.-n,--dry-runDry run; do everything except deleting files and resetting timestamps. This is usually only useful together with
-v, so that you can see what would happen in a real run. The output is accurate as far as files are concerned, but it is not accurate for directories. The output lists all directories older than specified, even the ones which are not empty; during a real (non-dry) run, only the empty directories are removed.-p,--preserve-mtimePreserve directory modification times; this is generally what you want, but turned off because it does not reflect standard unix behavior.
Under some circumstances the modification times of some directories might be changed; here's an example when this could happen:
You have a directory
Awith a modification time of April 11.The directory
Acontains a fileBwith a modification time of April 10.You run rmold with
-m 10onAonce a day.Until April 19, nothing happens. On April 20, the file
Bis removed. Thus modification time of the directoryAis changed to April 20. This means that the now empty directory will not be deleted until April 30 - probably not what you want.
This option avoids this problem by resetting a directory's modification time to the value it had before if a file (or directory) inside it was deleted. Notice that this also means that the directory's modification time does not reflect the last change any more, as you're used from unix.
-r,--recursiveProcess the specified directories recursively. This does only process hidden directories together with
-a.-v,--verboseBe verbose. You can repeat this option (
-vv) to increase the verbosity.--helpDisplay some help and exit.
--versionDisplay version information and exit.
Examples
Recursively remove all files and directories (even hidden ones)
older than a month from /srv/share:
rmold -arm 30 /srv/share
Author
rmold is copyright (C) 2005-2006 Aaron
Isotton <aaron@isotton.com>. You may use it under the
terms of the GNU General Public License, version 2.
Source code and newer versions are available from http://www.isotton.com/utils/rmold/.
Report bugs to <aaron@isotton.com> with
“[rmold]” as the first word of the subject.
