Search file in the directory function:
PHP Code:
function search($target, $directory){
if(is_dir($directory)){
$direc = opendir($directory);
while(false !== ($file = readdir($direc))){
if($file !="." && $file != ".."){
if(is_file($directory."/".$file)){
if(preg_match("/$target/i", $file)){
echo "$file
";
}
}else if(is_dir($directory."/".$file)){
search($target,$directory."/".$file);
}
}
}
closedir($direc);
}
return;
} ?>
No comments:
Post a Comment