Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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
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 surveying the Monastery: (7)
As of 2015-05-30 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (593 votes), past polls