Posted By


browncardigan on 02/08/10

Tagged


Statistics


Viewed 148 times
Favorited by 1 user(s)

getDirectoryTree


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getDirectoryTree($outerDir){
  2. $dirs = array_diff(scandir($outerDir), array(".", "..", ".DS_Store"));
  3. $dir_array = array();
  4.  
  5. foreach ($dirs as $d){
  6. if(is_dir($outerDir."/".$d)) {
  7. $dir_array[$d] = getDirectoryTree($outerDir."/".$d);
  8. }
  9. else {
  10. $dir_array[$d] = $d;
  11. }
  12. }
  13. return $dir_array;
  14. }

URL: http://bettesmidler.com/code/2009-07-22.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.