View Single Post
Old 08-29-2009, 08:08 AM   #1 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default Listing files and folders with scandir

I'm making a little script that will list the files and folders in a certain directory. Currently it looks like:

PHP Code:
<?php
//Scan the directory
$scan scandir("../www");

//Loop through the array
echo "<ul>";
foreach(
$scan as $key=>$value){
        echo 
"<li>".$value."</li>";
}
echo 
"</ul>";
Ideally I'd like to differentiate between what's a file and what's a folder. How would I do this?
__________________
Free CSS Tutorials
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote