I have the code searching through the directory and picks out all the folders, but I only want it to pick out ones that Start with Data. How would I do that?
Below is the code I have that goes through the Directory:
string[] filePaths = Directory.GetDirectories(defaultPath).Where(Data => !Data.EndsWith(".")).ToArray();
No need to use LINQ;
GetDirectoriessupports search patterns, and will probably be significantly faster since the filtering may be done by the filesystem, before enumerating the results in .NET.Note that
*is a wildcard which matches zero or more characters.