On Sat, Oct 25, 2003 at 04:16:49PM -0700, koly wrote:
: 
: [EMAIL PROTECTED] (Koly) wrote:
: > 
: > 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
: 
: sorry, after re-reading, I'm not sure this post makes sense - 
: 
: I'd like to get a count of all the ".jpg" files in a specific directory 
: and exclude all other files. 

$dir = '/path/to/specific/directory/';
$files = glob($dir.'*.jpg');
$count = count($files);

: Secondarily, I'd like to be able to refer to only ".thumb.jpg" files for 
: another instance (displaying those images) - but I assume once I figure 
: out how to parse/explode/read/exclude unwanted random file names, I'll 
: be able to figure out how to look for specific file names I want.
: 
: Basically, I need a kind of wildcard filename parse? Something like:
: 
:  if($file == '*.thumb.jpg')

foreach ($files as $file)
{
        if (preg_match('\.thumb\.jpg$', $file))
        {
                # do something
        }
}

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

Reply via email to