This will list all files in a directory
$handle=opendir('.');
echo "Directory handle: $handle\n";
echo "Files:\n<br>";
while ($file = readdir($handle)) {
echo "$file\n<br>";
}
closedir($handle);
Perhaps you can continue from here
Hope its what you want
Pryce