FileStream_getdirectories.htm

using System;
using System.IO;
//csc directory_getdirectory.cs
namespace dir_files
{
public class dir_create
{

public static void procces( string s )
{

string path = s;
try
{
// Only get subdirectories that begin with the letter "p."
string[] dirs = Directory.GetDirectories(@"c:\", path);
// if at least one sub directory is present
if (Directory.Exists(dirs[0])){
Console.WriteLine("The number of directories starting with " + s + " "+ dirs.Length);
foreach (string dir in dirs)
{
Console.WriteLine(dir);
}
}
else return;
}
catch (Exception e)
{
Console.WriteLine("Eoor in accessing: {0}", e.ToString());

}
finally {}
}

}//end of the class

class Test
{
public static void Main()
{
do
{
Console.WriteLine(" Search with first letter of the directory :");
Console.Write(" Search accepts *a* wild, now enter:");
string str =Console.ReadLine();
if(str !=""){ dir_create.procces(str);}
else return;

} while(true);

}

}

}