<add key ="Filepath" value="D:\Temp\Test" />
string strDirectoryPath =ConfigurationManager.AppSettings["Filepath"]; // Retrives the Directory Path if (Directory.Exists(strDirectoryPath)){ string[] strArrFiles = Directory.GetFiles(strDirectoryPath, "*.txt"); // Gets all the textfile from the Directory path if (strArrFiles.Length > 0) { label1.Text=strArrFiles.Length + " File(s) found in the Directory!"; } else { label1.Text="No File(s) in the Directory!"; }}else{ label1.Text = strDirectoryPath +" doesnt Exists";}