I've got a bug on a website application where the client uploads N images to a directory. Server config is Linux / Apache / Mysql / PHP.

This worked fine at the beginning, but now we seem to have intermittent problems, i.e. some files get uploaded bit others not, the ratio is about 60% success / 40% failure.

I fear this may be because there are too many files in the directory.

Can anyone tell me what the optimum number of files in any directory is ?

Or to put it another way, how would the fact that I have 10000 files in one directory effect the performance of the server ?

And is there any way of testing this.

Lastly, could anyone tell me the command to count the number of files in a partcular directory.

Thanks in advance