If I do this...

#!/usr/bin/perl
$dir = "$ENV{HOME}/";
opendir DIR, $dir ;
for (readdir DIR) {
-d and print "$dir$_$/"
}

....I aim to get all the files in my home directory that are directories, but the result is a list of only a few of the existing directories:

/Users/jd/.
/Users/jd/..
/Users/jd/dev
/Users/jd/Library

How do I get a list of all directories in a directory and, more to the point, what is the best way to get a complete tree starting from a certain directory?

JD

Reply via email to