Hi... Use below Query to get your desired files type collection:
- string FolderPath = @"D:\AllFiles";
- DirectoryInfo di = new DirectoryInfo(FolderPath)
- //Get All csv Files
- List getAllCSVFiles = di.GetFiles("*.csv")
- .Where(file => file.Name.EndsWith(".csv"))
- .Select(file => file.Name).ToList();
- //Get All Notepad Files
- List getAllNotePadFiles = di.GetFiles("*.txt")
- .Where(file => file.Name.EndsWith(".txt"))
- .Select(file => file.Name).ToList();


Pavan BujjiPosted Sep 24, 2017, 11:46 PM EDT
In the LIST "getALLCSVFiles".How to find the last file name and path ?.Please inform me bro.
Gowtham RajamanickamTOP 100Posted Mar 12, 2015, 10:06 PM EDT
Good one...