note
tilly
Here is a script I have used for a similar task in one
directory. I have changed the name of the directory
for obvious reasons:
<CODE>
#! /usr/local/bin/perl
die unless chdir "/some/hardcoded/dir/here";
die unless opendir DIR, ".";
foreach $file (grep {-f && (14 < -M)} readdir DIR) {
unlink $file;
}
closedir DIR;
</CODE>
Amusing note. I wrote this after accidentally crashing
someone else's ftp server by throwing the accumulated
contents of a large dir at it. The next day I went and
made every change I could think of that would have
prevented the disaster. Running this script daily was
one of those changes. :-)<P>
<B>EDIT</B><BR>
Hmmm...this was one of my earlier scripts. Definitely
before I learned the value of informative error messages.
And written in a hurry...but I think I should leave it
anyways as an example to show that my coding style has
matured...
28912
28912