Possible Duplicate:
Get the hierarchy of a directory with PHP
Getting the names of all files in a directory with PHP
I have seen functions to list all file in a directory but how can I list all the files in sub-directories too, so it returns an array like?
$files = files("foldername");
So $files
is something similar to
array("file.jpg", "blah.word", "name.fileext")
I think you're looking for php's glob function. You can call
glob(**)
to get a recursive file listing.EDIT: I realized that my glob doesn't work reliably on all systems so I submit this much prettier version of the accepted answer.
from: http://www.phpfreaks.com/forums/index.php?topic=286156.0
PHP documentation:
I needed to implement the reading of a given directory, and relying on the function of Chuck Vose, I created this page to read the directories relying on JQuery:
The structure used in the tree with JQuery, the site was taken: http://jquery.bassistance.de/treeview/demo/
I hope it is useful!
So you're looking for a recursive directory listing?