hjp: Programs: cleandir


A perl script to remove unused files from a temp directory. Redhat's tmpwatch acted rather strangely, and an older shell script I had, had a rare but disastrous (and not easily fixed) bug, so I decided to write one from scratch (I am sure it could be shorter, though).

This is part of my collection of simple tools — the complete repo is available on GitHub.

cleandir-1.8.tar.gz 2021-04-20 (3.9 kB)
Fix handling of directory with x but no r permission.
cleandir-1.7.tar.gz 2016-10-04 (3.9 kB)
- Assume file has vanished if we can't lstat it.
cleandir-1.6.tar.gz 2012-04-07 (3.9 kB)
Added -c option to check ctime only (Actually I did this in 2009, just forgot to package it).
cleandir-1.5.tar.gz 2008-02-15 (3.7 kB)
Added --include (-i) and --exclude (-x) options and made verbose output a bit more readable. This is also the first version with RPM and Debian packages.
cleandir-1.4.tar.gz 2003-12-01 (3.2 kB)
Critical bug fix: Empty directories were removed even with -n.
cleandir-1.3.tar.gz 2003-05-16 (3.1 kB)
Adds new options -s (to skip sockets and named pipes) and -m (to use only the mtime to determine the age of a file) and a man page (in pod format).
cleandir-1.2.tar.gz 2002-03-06 (2.1 kB)
Version 1.2 doesn't traverse filesystems any more (thanks to Chris Mason for the patch). It also adds a missing return at a rather critical place and a configure script to figure out where perl is. Upgrade highly recommended.
cleandir-1_1.tar.gz 2000-11-20 (1.5 kB)
Version 1.1 includes some checks to prevent directory/symlink switching attacks.
cleandir-1_0.tar.gz 2000-02-02 (1.1 kB)
vim: sw=2