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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -