Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to read a subfolder content

Status
Not open for further replies.

keith23

Technical User
Joined
May 26, 2005
Messages
97
Location
NL
Hi all. Here i have a small script that reads content of a folder and prints it name out. But the problem is that if i have a subfolder like this /mp3/andy/ it does not read and print the content of that folder. Is there a way to over come this problem?Thanks

Code:
<?php 
$folder=dir("./mp3"); 

while($folderEntry=$folder->read()){ 
echo $folderEntry."<br>"; 
} 

$folder->close(); 

?>
 
I'd do it recursively.

As you read each filename from the current directory, check it with is_dir().

If it is, make that directory your new current directory.



Want the best answers? Ask the best questions! TANSTAAFL!
 
sleipnir thank u for u reply. I be happy if show me how to use is dir() check since i am not familer with it.Thanks
 
I'm sorry, but the last sentence in your last post does not parse.

If you're asking for help with is_dir(), I've already posted a link to the PHP online manual page which describes the function. There is example code there.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top