in reply to Re: Create a list of directories without . and ..
in thread Create a list of directories without . and ..
something like: (i've not tested this!)
sure, this is not the fastest way (someone on the above referenced node timed the native find vs File::Find, with native winning by a factor of 5), but it's a way.my @found; File::Find::find({wanted => \&wanted], '.'); sub wanted { if (-d $_) && ($_ != '.') && ($_ != '..') { push(@found, $_) } }
also, be careful of the greps to remove the . and .. entries... it's legal to have directories that start with a period (or two, or more), so you have to do an exact match on both cases.
(i think)
i too am a newbie here, and i've been thanking people...
hopefully, i can provide some answers myself one day.
(ps: please forgive the expanded syntax, but it's (to my unPerlish eye) easier to read!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Create a list of directories without . and ..
by dsheroh (Monsignor) on Jun 04, 2002 at 19:37 UTC | |
by Juerd (Abbot) on Jun 04, 2002 at 22:41 UTC | |
|
Re: Re: Re: Create a list of directories without . and ..
by Juerd (Abbot) on Jun 04, 2002 at 22:39 UTC | |
by Anonymous Monk on Jun 05, 2002 at 04:15 UTC |