Title: RE: [Perl-unix-users] Removing files older than 10 days from a directory
if ( int( -M
$file) > $days || $days == 0 )
The only thing to be careful is if you
decide to make this a service or constantly running script, using the -M is
the point in time that the script starte
Title: RE: [Perl-unix-users] Removing files older than 10 days from a directory
Here is a little something I threw together awhile ago to clean up old log and data files.
It's not fancy, but it works okay for me.
-- This call would remove files older than 30 days from the $root/log and $root
Travis,
The attachment did not come through. Please try again or you can just
send it by email.
Thanks,
Craig
>>> Travis Hoyt <[EMAIL PROTECTED]> 11/07/03 01:57PM >>>
Here's our version for Oracle being backed up by Veritas NetBackup.
I tried to just cut and paste this but it isn't keeping
Here's our version for Oracle being backed up by Veritas NetBackup.
I tried to just cut and paste this but it isn't keeping the tabbing right. I'll upload it as a text attachment.
Our version is more complicated than previous versions offered but there is a great deal more accounted for with t
Thanks, I will give it a try!
>>> Peter Eisengrein <[EMAIL PROTECTED]> 11/07/03 07:47AM >>>
### untested
my $dir = '/dir';
opendir(DIR,$dir) || die "Can't open $dir : $!\n";
my @files = readdir(DIR); # you may want to grep only certain files
here
close(DIR);
foreach my $file(@files)
{
my
Title: RE: [Perl-unix-users] Removing files older than 10 days from a directory
### untested
my $dir = '/dir';
opendir(DIR,$dir) || die "Can't open $dir : $!\n";
my @files = readdir(DIR); # you may want to grep only certain files here
close(DIR);
foreach my $file(@files)
{
my $now
Travis,
You hit the nail on the head. I need to do the same with DB2 logs.
Thanks,
Craig
>>> Travis Hoyt <[EMAIL PROTECTED]> 11/07/03 06:14AM >>>
find /path/to/dir -mtime +30 -exec rm '{}' \;
however in some cases you may want to use perl to do this. if removing
the files is part of a large
find /path/to/dir -mtime +30 -exec rm '{}' \;
however in some cases you may want to use perl to do this. if removing
the files is part of a larger perl effort using the system or exec
function to call find could consume more resources than using native
perl calls. if you want to do it all in