Hi
How can I create a recursive method that counts how many files with a certain file extension, which is in a directory and the directory's sub directories. Exceptions that can be thrown in the search of the file tree should be handled appropriately.
The user of the program should specify the directory in which to start the search and the file extension for the type of files to be included, such as "*. cs. '

Im using windows form application.

Using System.IO;


Directory.GetFiles(@"c:\InitialPath", "*.cs", SearchOption.AllDirectories);

for the count try:
int count =Directory.GetFiles(@"c:\InitialPath", "*.cs", SearchOption.AllDirectories).Length;