$pattern = 'php';
$dh = opendir('c:/foo/bar'); 
while (false !== ($file = readdir($dh)))
{
    if ($file != '.' and $file != '..')
    {
        if (preg_match(, $file))
        {
            echo ;
        }
    }
}
closedir($dh);