Searching for a file.
| From: | Vincent M. | Date: | Tue, 18 Mar 2003 07:14:12 +0000 |
| Subject: | Searching for a file. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-140072@lists.php.net to get a copy of this message | ||
Hello,
I am looking for a way to search a file knowing the beginig of his name. For exemple, I know that the file I am looking for is:
montreal_000013_120.jpg
But I just know:
montreal_000013
And I can't know _120.jpg
So at this time I did this:
$dirthumbs = $dir."/thumbs" ;
$direc_src_obj2 = dir($dirthumbs) ;
while($entry=$direc_src_obj2->read()) {
if( substr($entry, 0, 15) == "$begining"){
$return[$i]["thumb"] = "$entry" ;
break ;
}
}
It works but it's not enough fast :-(
For resume, is there a way to do something like that:
ls montreal_000013*
without using the passthru function, I am looking for a native php function doing ls $mychar*
Thanks,
Vincent.