/ Published in: PHP
URL: http://www.miklabo.com/boxes/web/php/dir.html
http://www.fullposter.com/snippets.php?snippet=13 http://sourceforge.jp/projects/sfnet_dir-list/
Expand |
Embed | Plain Text
function scanDirectory($node, $limit=0, $separator="\\"){ //validate: //initialize: //RUN: $path=$current[0].$newSeparator.$it; $output[]=$path; $files = dirList($path); $directories[$path]=$files; }; }; } return $directories; /* keep this comment to reuse freely:*/ } function dirList ($directory) { // create an array to hold directory list // create a handler for the directory // keep going until all files in directory have been read // if $file isn't this directory or its parent, // add it to the results array if ($file != '.' && $file != '..') } // tidy up: close the handler // done! return $results; } $a = scanDirectory($path);
You need to login to post a comment.
