I want to return a list of all the subdirectories in the \'SomeFolder\' directory excluding the \'Admin\' and \'Templates\' directories.
I have th
You can do something like:
//list your excluded dirs
private List _excludedDirectories= new List() { "Admin", "Templates" };
//method to check
static bool isExcluded(List exludedDirList, string target)
{
return exludedDirList.Any(d => new DirectoryInfo(target).Name.Equals(d));
}
//then use this
var filteredDirs = Directory.GetDirectories(path).Where(d => !isExcluded(_excludedDirectories, d));