here is an other one i found
Here's another recursive function that prints out everything from the starting path to the end. It doesn't have any search function, but just another example. I wrote it for getting a quick hierarchial view of websites (even through Dreamweaver will show it to me, it'd be a chore to go through each folder and expand it).
PHP Code:
<?php
// map_dirs(path,level)
// path, level to start (start at 0)
map_dirs("/var/ww/html/",0);
function map_dirs($path,$level) {
if(is_dir($path)) {
if($contents = opendir($path)) {
while(($node = readdir($contents)) !== false) {
if($node!="." && $node!="..") {
for($i=0;$i<$level;$i++) echo " ";
if(is_dir($path."/".$node)) echo "+"; else echo " ";
echo $node."\n";
map_dirs("$path/$node",$level+1);
}
}
}
}
}
?>
all from here:
http://ca3.php.net/manual/en/function.opendir.php