Number of files in a directory.

S

supster

EDIT: I no longer need only specific file types in a directory, just
the total number of files!

Is there a more efficient way other than this:

string[] files = Directory.GetFiles(path);
count = files.length;


It seems like such a waste to have to create a full array of strings,
specially when the folder may contain thousands of files.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top