SPUG: getting a list of directories
Scott Blachowicz
sab at rresearch.com
Thu Jan 20 14:24:24 CST 2000
On Thu, Jan 20, 2000 at 11:53:39AM -0800, Todd Wells wrote:
> I'd like to get a list of directory names (and only directory names) in
> /usr/myapp. What's the best way to go about this? I wish the cookbook had
> a recipe for this. I see that readdir specifically excludes directory
> names.
How about something like this [untested] bit o code:
use File::Find;
my @dirs;
find(\&wanted, '/usr/myapp');
sub wanted { -d && push (@dirs, $File::Find::name); }
Scott.Blachowicz at seaslug.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list