I have program which writes to database which folders are full or empty. Now I\'m using
bool hasFiles=false;
(Directory.GetFiles(path).Length >0) ? hasFiles=
I'm assuming (although I don't know for definite) that because you're calling GetFiles() on a network drive it adds considerable time to retrieve all the files from all 30k folders and enumerate through them.
I've found an alternative Directory Enumerator here on CodeProject which looks promising.
Alternatively... you could create a WebService on the server that enumerates everything for you and returns the results after.
EDIT: I think your problem is more likely the folder access. Each time you access a Directory in the network drive you're going to be hitting security and permission checks. That * 30k folders will be a big performance hit. I highly doubt using the FindFirstFile will help much as the actual number of files enumerated will only ever be 0 or 1.