Eric Gregory wrote:

> Ok, I've got this script which I pulled off of a website for rotating
> apache logfiles.  But since I'm runnig numberous sites on my server it
> doesn't quite do what I need.
> 
> It works just fine for a single set of logfiles for instance if the files
> are in /logs/test in the example below.  but what I have is a number of
> subdirectories under /logs/test like /logs/test/site1, /logs/test/site2,
> /logs/test/site3
> 
> I'd like the script to go to each directory under the test directory and
> rotate the logs there, how do I do this.
> 

have you try the File::Find module where it can traverse a directory and all 
it's sub directories? example:

#!/usr/bin/perl -w
use strict;
use File::Find;

find(\&process,'/');

sub process{
        print "I found $_ in $Fild::Find::dir\n";
        #-- also $Fild::Find::filename is the complete path if you
        #-- don't need the directory and the filename separately
}

__END__

please read perldoc File::Find

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to