Lil' Directory listing PHP app: HTML
<?php function getFileListing($path){ // this function prints // all the files and sub directories in the path it was passed // -adj 8.7.02
$i=0;
if ($dir = @opendir($path)) { while($file = readdir($dir)) { if (($file!=".")&&($file!="..")){ if (is_dir($path."/".$file)){ print "<B>"; } // print current itteration print $file; // check if it's a directory if (is_dir($path."/".$file)){ // got a dir, call ourselves and use UL to indent print "</B>\n<UL>\n"; getFileListing($path."/".$file); print "</UL>\n"; } print "<BR>\n"; $i++; } } closedir($dir); } else { print "error - could not @opendir(".$path.")"; return 0; }
//done return 1;
} ?>
|
|