glob will provide you with all the files in this directory, but not subdirectories. If you also need this, you need: 10. get recursive, 20. goto 10.
Here's the pseudo pseudo code:
function getFiles($pattern, $dir) { $files = glob($dir . $pattern); $folders = glob($dir, GLOB_ONLYDIR); foreach ($folders as $folder) { $files = $files + getFiles($folder); } return $files; }
The foregoing, obviously, will need to be set up to make it work, but I hope you get this idea (remember that you should not refer to the catalog links to ".." or ".", Or you will be in the endless city of the loop).
nickf source share