I am trying to get the names of all first level directories under given path.
I tried to use File::Find but had problems.
Can someone help me with that?
I am trying to get the names of all first level directories under given path.
I tried to use File::Find but had problems.
Can someone help me with that?
Using File::Find::Rule
Or using File::Find::Rule frontend findrule
If you don't need to traverse the entire directory hierarchy, File::Slurp is much easier to use than File::Find.
And if you ever do need to traverse a hierarchy, check CPAN for friendlier alternatives to
File::Find
.File::Finder and File::Find::Rule are front-ends for
File::Find
.File::Find::Closures is worth studying to learn how to use
File::Find
and how to write closures.File::Next uses an iterator approach to directory traversal and looks promising, although I have never used it.
Finally, in the spirit of TIMTOWTDI, here's something quick and sleazy: