Created
November 13, 2014 20:46
-
-
Save PartTimeLegend/a941bb756b9d58d6877b to your computer and use it in GitHub Desktop.
Find all .xls files in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IList<Documents> FindDocuments() | |
{ | |
DriveInfo[] allDrives = DriveInfo.GetDrives(); | |
IList<Documents> documentsList = new List<Documents>(); | |
foreach (DriveInfo d in allDrives) | |
{ | |
foreach (var file in Directory.GetFiles(d.ToString(), "*.xls", SearchOption.AllDirectories)) | |
{ | |
Documents documents = new Documents(); | |
documents.FilePath = file; | |
documentsList.Add(documents); | |
} | |
} | |
return documentsList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment