Hi John,
I'm reluctant to believe you on the spaces issue with readdir(). I checked the manual and nobody in the discussion has ever mentioned it. Maybe you think that it skips the files but in fact, something else down the road in your script does.
Anyways, try using glob() instead. It will make your script look prettier :-)
Something along these lines:
$pattern = "$dir/*.txt";
$files = glob($pattern);
var_dump($files);
...
Petr 'PePa' Pavel
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.