Pay no attention to the "dir is a command" silliness above.. we'll all chip in a few bitcoins and buy Allen a coffee! \:D

Try changing
 Code:
$filename2 = dir()
to ()
 Code:
$filename2 = dir("",1)
in your code - you need to match the enumeration indices.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D