Enumerate Files in a Directory

Virendradugar
Posted by Virendradugar under C# category on | Views : 3868
DirectoryInfo ourDir = new DirectoryInfo(@"c:\windows");
Console.WriteLine("Directory: {0}", ourDir.FullName);
foreach (FileInfo file in ourDir.GetFiles())
{
Console.WriteLine("File: {0}", file.Name);
}

Comments or Responses

Login to post response