rendered paste body<?php$extenstions = array('php','inc');$ignore = array('index.php');//$path = "/var/www";$path = "c:/web/simple";$filelist = build_dir($path,$extenstions);walk_dir($filelist,0);function walk_dir($array,$level) { $pad = " "; foreach ($array as $name=>$content) { //echo str_pad("",$level,$pad,STR_PAD_LEFT); if (is_array($content)) { echo $content['PATHNAME']."/<br />\n"; unset($content['PATHNAME']); walk_dir($content,$level+1); } else { echo $content."<br />\n"; } }}function build_dir($path,$extensions,$ignore) { $result = array(); $d = dir($path); while(false !== $entry = $d->read()) { if (in_array($entry,$ignore)) { continue; } $extpos = strrpos($entry,"."); $file = substr($entry,0,$extpos); $ext = substr($entry,$extpos+1); if (is_dir($path."/".$entry)) { if (substr($entry,0,1) == ".") { continue; } $res = build_dir($path."/".$entry,$extensions); if (count($res) > 0) { $res['PATHNAME'] = $path."/".$entry; $result[$entry] = $res; } } else if (in_array($ext,$extensions)) { $result[$entry] = $path."/".$entry; } } ksort($result); return $result;}?>