Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Getting the names for >200 directories

Thread Tools

Getting the names for >200 directories
Posts: n/a
I am attempting to either put into an array, or just iterate through
all the names of the directories I have.

I can do this with:-

my @dir_names = grep -d "$path/$_", readdir DIR;


opendir(DIR, $path) or die "cant find $path: $!";
while (defined(my $file = readdir(DIR))) {
next if $file =~ /^\.\.?$/;
if (-d "$path$file"){

However there are > 200 directories, and there seems to be a hard
limit of 200 when I try to store or iterate through.

Is there any way round this, and why does it occur?

Many thanks
Reply With Quote
Posts: n/a
OK, seems like its a problem elsewhere in the code as I did a quick
little test of both methods on their own, and they seem to work fine.
Reply With Quote
Tad J McClellan
Posts: n/a
      08-26-2008 Removed) <(E-Mail Removed)> wrote:

> my @dir_names = grep -d "$path/$_", readdir DIR;


> while (defined(my $file = readdir(DIR))) {
> next if $file =~ /^\.\.?$/;
> if (-d "$path$file"){


Where is the directory separator?

Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
virtual directories/physical directories in IIS Paul F ASP .Net 4 06-25-2008 04:04 PM
Multiple bin-directories with virtual directories? =?Utf-8?B?TGFzc2UgTmlsc3Nvbg==?= ASP .Net 0 11-09-2004 05:49 PM
Getting all directories/files from current directory and using -d flag for the directories Adam Petrie Perl Misc 8 10-11-2004 01:28 PM
How to map Project directories to Production sub-directories Joel Finkel ASP .Net 0 09-12-2003 06:47 PM
Using virtual directories for common directories (scripts, images, styles, etc.) Jeffry van de Vuurst ASP .Net 2 07-30-2003 07:00 PM