in reply to Re^2: Deleting a Temp File
in thread Deleting a Temp File
Also, File::Find (or anything related to it) is overkill if you just have one directory (no subdirectories) where the temp files are kept:
If you want to focus on files that are, say, just 2 hours old or older, use "2/24" instead of "1" to test against the value of "-M".# get a list of data files that are at least one day old in /my/tmpdir +: opendir( TMP, "/my/tmpdir" ); my @dayold = grep { /[^.]/ and -f and -M _ > 1 } readdir TMP; closedir TMP; # don't like old files? kill 'em off: unlink map { "/my/tmpdir/$_" } @dayold;
|
|---|