I want to create a php script which finds all files with name favicon_323123.ico
. Of course, string _323123
is not static.
This is my current code:
<?php
$filepath = recursiveScan('/public_html/wp-admin/');
$text = 'favicon' .*. 'ico'
function recursiveScan($dir) {
$tree = glob(rtrim($dir, '/') . '/*');
if (is_array($tree)) {
foreach($tree as $file) {
if (is_dir($file)) {
//echo $file . '<br/>';
recursiveScan($file);
} elseif (is_file($file)) {
if (strpos($file, $text) !== false) {
echo $file . '<br/>';
//unlink($file);
}
}
}
}
}
?>