here is my way of doing something like this (i've only included the file part)
$directory = "/path/to/images/images/";
$dirhandle = opendir($directory);
while( $filename = readdir($dirhandle) ) {
// this will split up directories and files
$temp = $directory;
$temp .= $filename;
$temp .= '/';
if ( is_dir($temp) ) {
// check to see if directory or not.
// rid of ".." and "."
if ( ($filename != ".") || ($filename != "..") ) {
$dirlist[] = $filename;
}
} else if ( !is_dir($filename) ) {
if ( ($filename != "..") || ($filename != ".") ) {
$filelist[] = $filename;
}
}
} // end while
// now we have two arrays, dirlist and filelist
// run through filelist..
while ( (list(,$file) = each($filelist)) ) {
if ( eregi("homeimage",$file) ) {
// okay we have a match with homeimage
echo "Found a match!";
} else {
echo "No match was found in this directory!";
}
hope this could help,
~kyle