UBB.Dev
Posted By: JohnM Subdirectories - 02/15/2001 8:29 AM
How can I list all directories under a certain one?
Posted By: Charles Capps Re: Subdirectories - 02/15/2001 11:14 AM
opendir(DIRHANDLE, $path) or die $!;
my @arrayofentries = readdir(DIRHANDLE);
closedir(DIRHANDLE);

my @directories;
foreach(@arrayofentries) { if(-d "$path/$_") { push(@directories, $_); }
}

Expensive, but functional... assuming -d is indeed the directory checker.
Posted By: JohnM Re: Subdirectories - 02/15/2001 8:46 PM
Thanks.
Posted By: JohnM Re: Subdirectories - 02/15/2001 8:47 PM
Hmm - above it shows four stars for my rating, but in my profile it says 1 vote for 5 stars?
Posted By: Burak Re: Subdirectories - 02/24/2001 9:42 PM
I have a question Charles smile

lets say I used the above code to get the dir names (10 directories maybe) and put them in a variable "$i"
these dirs have a total of 1000 data files and I put the name of theses files to a variable "$id" and split the data in each file and get a variable $name from each file

if I use this;

print "$name";

what happens? will the server die? laugh

*I'm reading the dir(s) and opening 1000 file at the same time :D*

[ February 24, 2001: Message edited by: jeologic ]
Posted By: Charles Capps Re: Subdirectories - 02/25/2001 2:14 AM
You would murder the server.... *L*
© UBB.Developers