Need help with Perl function File::find
I'm trying to find all of the files in directory tree c:\logs\ on a Windows server that are in the form ex*.log
I've tried using the File::find function to look through subdirs recursively, and although it finds the files fine, when I try pushing those into a separate array I get more than I want. I seem to get one copy in the array for every file that exists in the subdirectories, whether or not the start with ex*
I don't get how this function works...HELP!!
What I've been playing with:
#start here
use File::Find;
my $path = 'c:\\logs';
finddepth (\&process, $path);
sub process
{
if ($File::Find::name = /ex\w*.log/) {
print "processing $File::Find::dir"."/"."$Fi
le::Find::
name \n";
push @winlogs, $File::Find::name;
}
#do the file actions here after the array works
}
Start Free Trial