Using glob to find all files

86 views Asked by At

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?

0

There are 0 answers