php - list only directories that contain certain files -


the following code below works fine listing directories , excluding don't want in array list, i'd add feature able list directories contain files.

for example: list directories contain files: array('file1.php','file2.php');

$exclude = array('admin','inc');         foreach(glob('./*', glob_onlydir) $dir) { $dir = str_replace('./', '', $dir); if (!in_array($dir, $exclude))   {     //list directories } } 

$exclude = array('admin','inc');  $required = array('file1.php', 'file2.php'); foreach(glob('./*', glob_onlydir) $dir) { $dir = str_replace('./', '', $dir); if (!in_array($dir, $exclude))   {     foreach($required $r) {         if (file_exists("$dir/$r")) {             echo $dir, "\n";             break;         }     } } } 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -