Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to determine whether a dir entry is a directory?

by jffry (Hermit)
on Feb 14, 2006 at 17:05 UTC ( [id://530164]=note: print w/replies, xml ) Need Help??


in reply to How to determine whether a dir entry is a directory?

sub readin_dirs { my $dir = shift; my $DIR; # I use variable file handles so function can be reentrant opendir $DIR, $dir or die "opendir $dir - $!"; my @entries = readdir $DIR; # Get only directories from dir listing. my @subdirs = grep { -d "$dir/$_" } @entries; # Remove "hidden" directories (including . and ..) from that list: @subdirs = grep { !/^\./ } @subdirs; for my $subdir ( @subdirs ) { now_do_something("$dir/$subdir"); } closedir $DIR; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://530164]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found