Aaron Isotton

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, --all

Also delete hidden files; if -r is specified, also recurse into hidden directories.

-m, --max-age=MAX-AGE

Delete files and directories older than MAX-AGE days. This option is required.

-n, --dry-run

Dry 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-mtime

Preserve 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 A with a modification time of April 11.

  • The directory A contains a file B with a modification time of April 10.

  • You run rmold with -m 10 on A once a day.

  • Until April 19, nothing happens. On April 20, the file B is removed. Thus modification time of the directory A is 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, --recursive

Process the specified directories recursively. This does only process hidden directories together with -a.

-v, --verbose

Be verbose. You can repeat this option (-vv) to increase the verbosity.

--help

Display some help and exit.

--version

Display 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 . 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 with “[rmold]” as the first word of the subject.

See Also

find(1), rm(1), stat(1), touch(1), xargs(1)