Previous Thread
Next Thread
Print Thread
Rate Thread
#102226 02/15/2001 1:29 AM
Joined: Mar 2000
Posts: 615
Member
Member
Offline
Joined: Mar 2000
Posts: 615
How can I list all directories under a certain one?

Sponsored Links
#102227 02/15/2001 4:14 AM
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
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.


UBB.classic: Love it or hate it, it was mine.
#102228 02/15/2001 1:46 PM
Joined: Mar 2000
Posts: 615
Member
Member
Offline
Joined: Mar 2000
Posts: 615
Thanks.

#102229 02/15/2001 1:47 PM
Joined: Mar 2000
Posts: 615
Member
Member
Offline
Joined: Mar 2000
Posts: 615
Hmm - above it shows four stars for my rating, but in my profile it says 1 vote for 5 stars?

#102230 02/24/2001 2:42 PM
Joined: May 2000
Posts: 1,356
Addict
Addict
Joined: May 2000
Posts: 1,356
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 ]

Sponsored Links
#102231 02/24/2001 7:14 PM
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
You would murder the server.... *L*


UBB.classic: Love it or hate it, it was mine.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)