in reply to How do I find directories within directories using : parse_dir(`ls -l`)
read_dir returns a list of directory contents.
grep -d selects only directories (filtering out files).
use File::Slurp; my @dirs = grep { -d "$dir/$_" } read_dir($dir);
To include the . and .. special directories, add the keep_dot_dot option:
my @dirs = grep { -d "$dir/$_" } read_dir($dir, keep_dot_dot=>1);
|
|---|