I've searched until I dropped, but it payed off. I've found the problem:
The program reads a directory in a while loop until there is nothing more to read. This was done with the following code:
while ($file = @readdir($handle)) {
On the php.net site I found that this had to be:
while (false !== ($file = @readdir($handle))) {
In this way also 0 directories are processed.
Joris