I was using this readdir to find a file in a folder
$handler = opendir($folder);
while ($file = readdir($handler)) {
if ($file != "." && $file != ".." && substr($file,0,7) == '98888000') {
print $file. "<br />";
}
}
but since I have tons of files in the folder it takes some minutes to complete the request: how can I fast it up?
Consider I’m on PHP5 + IIS.
I’ve tried even glob()
foreach (glob($folder.98888000."*.pdf") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
but it returned nothing.
What about
globmaybe? It finds files matching a pattern:might work.
If you need
opendirandreaddir, then you might want to have a look atfnmatch.