iterated function that searches a folder or file in a directory.
<?php
$root = '../Classes';
$search_parameter = "CachedObjectStorageFactory.php";
//if we call the function spider as spider($root);
//will show all the directory content including subdirectories
//if we call the function spider as spider('../Classes', 'Shared');
//and will show the address of the directory
spider($root, $search_parameter);
closedir();
function spider($dir,$fileName=""){
$handle = opendir($dir);
while($file= readdir($handle)){
if($file != "." && $file != ".."){
if($fileName=="")
echo $dir."/".$file."<br>";
else
if($file == $fileName)
echo $dir."/".$file."<br>";
if(!is_file($dir."/".$file))
spider($dir."/".$file,$fileName);
}
}
}
?>