Advertisement

03.25.2007 at 11:14AM PDT, ID: 22471219
[x]
Attachment Details

HELP!!  File::Find in perl

Asked by itcs-css in Shell Scripting, Perl Programming Language, CGI Scripting

Tags: perl, find

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"."/"."$File::Find::name \n";
      push @winlogs, $File::Find::name;
      }  
         #do the file actions here after the array works
}Start Free Trial
[+][-]03.25.2007 at 05:02PM PDT, ID: 18789912

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.25.2007 at 05:03PM PDT, ID: 18789913

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.25.2007 at 06:24PM PDT, ID: 18790084

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.25.2007 at 07:49PM PDT, ID: 18790469

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.25.2007 at 08:02PM PDT, ID: 18790504

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.25.2007 at 10:10PM PDT, ID: 18790814

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.25.2007 at 11:54PM PDT, ID: 18791056

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.25.2007 at 11:56PM PDT, ID: 18791062

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Shell Scripting, Perl Programming Language, CGI Scripting
Tags: perl, find
Sign Up Now!
Solution Provided By: mjcoyne
Participating Experts: 3
Solution Grade: A
 
 
[+][-]03.26.2007 at 06:40AM PDT, ID: 18792655

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32