[PHP] reading/parsing file names

2003-10-25 Thread koly
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.

--
koly out.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] reading/parsing file names

2003-10-25 Thread Evan Nemerson
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
[EMAIL PROTECTED]

--
I am indeed amazed when I consider how weak my mind is and how prone to 
error. 

-Rene Descartes

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php