In my recurive function to zip a whole folders i have this piece of code glob($path. \'/*\') that give me all files and subfolders matching my $path.
Here I read
Probably you've found already the solution, but in case you were looking for a way that gives you the files and directories, recursively and taking care of hidden files, this was what I got:
function rglob($pattern, $flags = 0) {
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
$files = array_merge($files, $this->rglob($dir.'/'.basename($pattern), $flags));
}
return $files;
}