How can I search a specific directory and its subdirectories for a specific file?
What I've tried are the following two functions:
function getImageDirectory($ipaPath) {
$oDirectory = new RecursiveDirectoryIterator($ipaPath);
$oIterator = new RecursiveIteratorIterator($oDirectory);
foreach($oIterator as $oFile) {
if ($oFile->getFilename() == 'info.plist') {
return $oFile->getPath();
}
}
}
EDIT: This one works, just as well as the answer bellow! My example above return the directory of the file you are looking for, in this case "info.plist".
EDIT2: Thanks for the down votes! If someone would have asked a similar question it would have shown when I wrote the title. But nothing for PHP. So if I search for the wrong thing, not using developer language it shouldn't be down voted! And now someone with my low php skills might find an answer to this question! Is stackoverflow only for PRO's or for anyone that needs help?