Re: reading/parsing file names
| From: | Evan Nemerson | Date: | Sat, 25 Oct 2003 23:14:36 +0000 |
| Subject: | Re: reading/parsing file names | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167597@lists.php.net to get a copy of this message | ||
php.net/substr
php.net/ereg
php.net/preg_match
foreach ( $files as $filename )
if ( substr($filename, -4) == '.jpg' )
array_push($jpegs, $filename);
Keep in mind, though, that not all JPEG files end with jpg. There is also jpe
and jpeg, and you have to consider case sensitivity.
On Saturday 25 October 2003 03:41 pm, koly wrote:
> my problem:
> I've got a list of files in a directory, and I'd like to get a only of
> filenames that end in ".jpg", however, exlude the files that end in
> ".thumb.jpg"
>
> ex:
> file.php
> index.htm
> photo.jpg
> photo.thumb.jpg
> etc
>
>
> how can I count only those files that end with ".jpg" ?
>
> Any help appreciated.
--
Evan Nemerson
evan@coeus-group.com
--
"I am indeed amazed when I consider how weak my mind is and how prone to
error. "
-Rene Descartes