Reading contents of a directory, but not some files?
Posted: Wed Jan 03, 2007 8:46 pm
Ok, so listing the contents of a directory is usually with this:Now that lists all the files that end in .jpg however the images, which are listed in the same directory, are named like so: image1.jpg, image1thumb.jpg, image2.jpg, image2thumb.jpg, etc..
What's the easiest way to get it to only list the filenames that are image1thumb.jpg, image2thumb.jpg, etc... ??
Thanks 
Code: Select all
<?php
$image_folder = "content/directory";
$handle = opendir($image_folder);
while($entry = readdir($handle))
{
if( ($entry != "." || $entry != ".."))AND(ereg(".jpg",$entry)>0) )
echo "$entry<br>";
}
closedir($handle);
?>What's the easiest way to get it to only list the filenames that are image1thumb.jpg, image2thumb.jpg, etc... ??