cooldude832 Posted July 8, 2007 Share Posted July 8, 2007 The title says it all i guess Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 8, 2007 Share Posted July 8, 2007 function dirTree($dir) { $d = dir($dir); while (false !== ($entry = $d->read())) { if($entry != '.' && $entry != '..' && is_dir($dir.$entry)) $arDir[$entry] = dirTree($dir.$entry.'/'); } $d->close(); return $arDir; } function printTree($array, $level=0) { foreach($array as $key => $value) { echo "<div class='dir' style='width: ".($level*20)."px;'> </div>".$key."<br/>\n"; if(is_array($value)) printTree($value, $level+1); } } Usage is as simple as this: $dir = "<any directory you like>"; $arDirTree = dirTree($dir); printTree($arDirTree); Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 8, 2007 Share Posted July 8, 2007 Slightly shorter ... put this in the target folder <?php $num = glob("*.*"); echo count($num). " files"; ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 8, 2007 Author Share Posted July 8, 2007 glob I always forget about you.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.