-
-
Save gavinhewitt/264b50085acfb37ea4991ddeddf94f64 to your computer and use it in GitHub Desktop.
Util function for a recursive filesearch using glob function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************** | |
* | |
* Util function for a recursive filesearch using glob function | |
* | |
****************************/ | |
if ( ! function_exists('glob_recursive')) { | |
// Does not support flag GLOB_BRACE | |
function glob_recursive($pattern, $flags = 0) { | |
$files = glob($pattern, $flags); | |
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { | |
$files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); | |
} | |
return $files; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment