Sorry, forgot to send it to the list...

Ray

-----
Hi Andrew,

AndrewMcHorney wrote:
> I am working on a perl script that will go through a directory and
> it's subdirectories and purge all the files that are more than a
> specified number of days old. I am using a Unix system so I do a find
> command to gather up the files I want. I then am going to do a stat
> command to find the date the file was created (it is never modified)
> and then determine if it is to be deleted. What is the easiest way to
> determine if a date is more than x number of days old.

In Perl? I wrote such a script -- yet, I do not know if this is the
"easiest" way to do it.

I used -M to do it (http://perldoc.perl.org/functions/-X.html):

my $days = sprintf ("%.2f", -M $fn);
if ((defined $days) && ($days > $daylimit)) {
rmtree ($dir);
}
}

where $daylimit is a value provided earlier. Seems to work fine...

Ray


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to