Directory List - Strip Files
Posted: Sat Apr 15, 2006 5:56 pm
I'm trying to create a script that lists out directories in a <select> dropdown. I've figured out how to list a complete directory (script below), but now I have to figure out how to remove all of the files (I only need the directories). Any tips?
Thanks,
Marcus
Thanks,
Marcus
Code: Select all
<select>
<?
$path = "/home/kinetici/public_html/pbluff/test single file/download/";
$dir_handle = @opendir($path) or die("Unable to open $path");
while ($file = readdir($dir_handle)) {
if($file == "." || $file == ".." || $file == "index.php" )
continue;
echo "<option value=\"$file\">$file</option>";
}
// Close
closedir($dir_handle);
?>
</select>