[thelist] Perl Problem.

Peter Bancroft pdb103 at cs.york.ac.uk
Wed Aug 30 05:24:23 CDT 2000


Excellent... that solved it... stupid mistake on algian's part.  Thanks
everyone for taking the time to get a solution.. It has really helped and I
don't think he'll be jumping out of his 3rd floor window after all.
-Peter

----- Original Message -----
From: Michael Percy <mpercy at portera.com>
To: <thelist at lists.evolt.org>
Sent: 28 August 2000 23:35
Subject: RE: [thelist] Perl Problem.


> Try this:
> -------------------------------------------------
> #!perl -w
>
> # get the time now and set time limit
> my $dir = 'c:/my/directory/here/';
> my $now = time;
> my $secs = 18000;
>
> #get the file and delete as appropriate
> opendir (TEMP, $dir);
> foreach (readdir(TEMP)) {
> # If the filename does not end in .save and +5 hrs old, kill it
> if ( (!( /\.save$/ || /^(\.|\.\.)$/ )) && (-f "${dir}/${_}") ) {
> my @stats = stat("${dir}/${_}");
> my $atime = $stats[8];
> print "$_ $atime\n";
> if (($now - $atime) > $secs) {
> unlink("${dir}/${_}");
> print("Killed: ${dir}/${_}\n");
> }
> }
> }
> closedir (TEMP);






More information about the thelist mailing list