in reply to problem running executable in subdirectories
Here is one way to get just the subdirectories of the current directory (using File::Slurp, grep and -d), then run your command in each dir (using chdir and system):
use strict; use warnings; use File::Slurp qw(read_dir); my @dirs = grep { -d } read_dir('./'); for (@dirs) { chdir $_; system '/somepath/foo.exe'; }
If you want to run it in all directories recursively, then find or File::Find would be appropriate.
You should be specific about the problem you are having. Why doesn't it work for you?
You should choose a more meaningful title for your question, like: "Problem running command in subdirectories.".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: trouble with a simple script
by ikegami (Patriarch) on Jul 07, 2010 at 19:14 UTC |