Quick example:
$directory_name is the name of the directory where you want to start, INCLUDING a trailing /. $file_name is the name of the file. $list is the array in which you want to store the addresses of any files with the specified name (i.e. if you have multiple files with that name, all will appear in the list.)
Code:
function find_directory($directory_name, $file_name, &$list){
$content = scandir($directory_name);
foreach ($content as $value) {
if ($value=="." || $value=="..") {
} else {
$absolute = $directory_name.$value;
if ($value === $file_name) {
$list[] = $absolute;
} else if (@is_dir($absolute)) {
find_directory($absolute."/", $file_name, $list);
}
}
}
}
Horrible, but it works.
To use it:
Code:
$list = array();
find_directory("/home/wherever/","bla.bla.conf",$list);
Now you can do whatever you want with $list, which contains a list of full paths to all files with the name you wanted, in this case bla.bla.conf.