File list
=$factor;$i++) $val /= $factor; $p = strpos($val, "."); if($p !== false && $p > $digits) $val = round($val); elseif($p !== false) $val = round($val, $digits-$p); return round($val, $digits) . " " . $symbols[$i] . $bB; } // This is the directory to list files for. $theDirectory = "./"; // Do you want to show directories? change to false to hide directories. function drawTree($rootDir) { if(is_dir($rootDir)) { echo "
"; // Make Array of Files and Array of Dirs $dir = opendir($rootDir); $file_number=1; while(false !== ($file = readdir($dir))) { $type = filetype($rootDir ."/". $file); if($type == "dir" && $file!="." && $file!=".." && $file!="cgi-bin") { $dir_array[$file_number] = $file; } if($type != "dir" && $file!=".DS_Store" && $file!="index.php") { $file_array[$file_number] = $file; } $file_number+=1; } closedir($dir); // Loop through arrays and draw folder tree if ($dir_array) { foreach($dir_array as $subdir) { echo "
" . $subdir . "
\n"; drawTree($rootDir . $subdir . "/"); } } if ($file_array) { foreach($file_array as $file) { echo "
" . formatbytes(filesize($rootDir . $file)) . "
" . $file . "
\n"; } } echo "
"; } else { echo "
" . $rootDir . " is not a directory"; } } drawTree($theDirectory); ?>