The [man]glob[/man] function doesnt go into sub directories basically it reads either the current working directory
glob("*");
or the specified directory
glob("/path/to/*");
it wont read the directory if there are sub directories, now this doesnt mean its not possible it just requires more work (if you want to search I have an example using [man]opendir[/man] in a thread not that long ago which may work for you). Basically the glob function will need to be within a function which is to be recursive.
Here is a basic structure which isnt tested and probably wont work
function glob_recur($path, $match)
{
foreach (glob("*") as $filename) //need to find directory
{
if (is_dir($filename))
glob_recur($filename, $match);
else if (preg_match($match, $filename))
$array[] = $filename;
}
return $array;
}
Just an example now of course it doesnt match what you requrie but finds directories you could probably call the glob function twice in the function and set the first to find the directories only and the other to actually do the match within that directory.