0

I am trying to find all files that exist in all subdirectories and the root folder with the `glob()= function. My code is like this:

chdir("/var/www/dwnlds/files");
foreach(glob("*") as $file) {
    print $file;
}

This code just prints from the current directory, so therefore I have tried to use this code:

 `glob("*/*");`

but that does only print the files in sub-directories, not in the root folder, and it does not continue to scan all subdirectories either, it just stops after the first (because of the pattern i have set of course) but what pattern or function can I use to find all files in all possible directories from the working directory?

Jørgen R
  • 10,568
  • 7
  • 42
  • 59
Lev
  • 3
  • 1
  • 1
    glob is not recusive. that's something you'll have to do yourself, or use a [directoryiterator](http://php.net/manual/en/class.directoryiterator.php) – Marc B Jun 23 '15 at 15:43
  • Possible duplicate of http://stackoverflow.com/questions/12109042/php-get-file-listing-including-sub-directories – Magicprog.fr Jun 23 '15 at 16:02

0 Answers0