Version: 1.0
Type: Function
Category: File Management
License: GNU General Public License
Description: This function will list all the directories & their files that are above the given root folder. This has no limits as to how many braches it creates.
<? // Copyright 2002 Adam Taylor // Email [email protected] function ListFiles($root) { if (!$root) $root = $_SERVER["DOCUMENT_ROOT"]."/"; if ($dir = @opendir($root)) { echo "<B>$root</b><BRn>"; $file = readdir($dir); $file = readdir($dir); $num = ""; while (($file = readdir($dir)) !== false) { $num = strstr($file, '.') ; if ($num != "") { echo "$file<BR>n"; } else { $newroot = $root.$file; echo "<BLOCKQUOTE>n"; ListFiles($newroot."/"); echo "</BLOCKQUOTE>n"; } } closedir($dir); } } // Syntax: ListFiles( Root Directory); // // The following will show all files in the document folder // of your server. ListFiles($_SERVER["DOCUMENT_ROOT"]."/"); ?>