finding files in a directory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
how to get the number of files in a directory...including the files in the
subdirectories...

is there any default method of Directory class..
please help out
 
new System.IO.DirectoryInfo(@"D:\MyFolder").GetFiles("*",
System.IO.SearchOption.AllDirectories).Length
 
AVL said:
hi,
how to get the number of files in a directory...including the files in the
subdirectories...

is there any default method of Directory class..
please help out

The Directory.GetFiles method will return an array of strings for all
files found. You can specify that it will look in all subfolders.
 

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

Back
Top