I want to access all file name which is text files in my specific folder i.e. "d:/Anupam Mishra". i am trying to use following code but i can not get correct output. Please give me a solution.
Code:
try
{
foreach (string dir in Directory.GetDirectories("d:"))
foreach (string fileName in Directory.GetFiles("d:/Anupam Mishra"))
Console.WriteLine(fileName );
}
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
{
{
}
Thank You.
Anupam Mishra
22-Jan-2016If we are using this code . it will working on above problem:
Output:
//retrieve all text files which is inside a specified directory.