There is another option.
In Red Hat Linux 4.2, there is a package called tmpwatch. Here is the
first part of the man page:
NAME
tmpwatch - removes files which haven't been accessed for a period
of time
SYNOPSIS
tmpwatch [-fav] [--verbose] [--force] [--all] [--test] <hours>
<dirs>
DESCRIPTION
tmpwatch recursively removes files which haven't been accessed
for a given number of hours. Normally, it's used to clean up
directories which are used for temporary holding space such as
/tmp.
When changing directories, tmpwatch is very sensitive to possible
race conditions and will exit with an error if one is detected.
It does not follow symbolic links in the directories it's clean-
ing (even if a symbolic link is given as its argument), will not
switch filesystems, and only removes empty directories and regular
files.
The source for this program is 294 lines of C (including comments). Enough care
seems to have been taken to avoid race hazards and my limited examination of
code satisfied me that there are no security problems with it. Specfically,
the program does everything itself, it does not rely on an external program for
any function which should eliminate problems associated with special characters
and/or buffer overflows due to deep paths.
The version that I have (tmpwatch-1.2-1.src.rpm) can be found at:
ftp://wuarchive.wustl.edu/systems/linux/redhat/redhat-4.2/SPRMS/tmpwatch-1.2.1-1.rpm
Steven Leikeim
Department of Electrical and Computer Engineering
University of Calgary
Calgary, Alberta
Phone: (403) 220-5373
Fax: (403) 282-6855