<?
$directory = '.'; # Directory to scan
$searchtxt = '351'; # Text to search in filename
$counter = 0;
if ($handle = opendir($directory)) { # Open directory
while (false !== ($file = readdir($handle))) { # Read the entries
if (strpos($file, $searchtxt) > -1) { # Search the text
$counter++; # Increase counter if found
}
}
closedir($handle); # Close the directory
}
echo "There are $counter files including '$searchtxt' in the filename.";
?>