Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Execute a for loop in many subdirectories

by dasgar (Curate)
on May 22, 2014 at 20:11 UTC ( #1087131=note: print w/ replies, xml ) Need Help??


in reply to Execute a for loop in many subdirectories

Don't know how many levels of subdirectories that you plan to search through, but you'll probably find File::Find (or File::Find::Rule, which I personally prefer to use) and the -X file test function to be useful.


Comment on Re: Execute a for loop in many subdirectories
Replies are listed 'Best First'.
Re^2: Execute a for loop in many subdirectories
by marlowvoltron (Novice) on May 22, 2014 at 20:34 UTC

    The depth is only 1, I don't need to go deeper than /antarctica/*

      The depth is only 1, I don't need to go deeper than /antarctica/*
      No need for File::Find then:
      my @dirs = grep -d, </antarctica/*>; for my $dir (@dirs) { chdir($dir) or die "Failed to chdir to $dir: $!"; execute_something(); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1087131]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (18)
As of 2015-07-30 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls