So I see a lot of inquiries about this issue with files, not so many with directories - and the ones that involve directories, often have answers that are convoluted and all over the place.
I just want to basically know, if there is a good way to handle the problem of queries that hit directories that are inaccessible, due to inadequate permissions. It seems like a lot of the posts on this subject suggest recursion - but I'd love to avoid that, if possible.
static string GetPathForMaskFiles(string startFolder)
{
// look for folders with a search string
string[] dirs = Directory.GetDirectories(@"" + startFolder , "*posfiles*", SearchOption.AllDirectories);
MessageBox.Show("There are " + dirs.Count() + " directories in the list");
string oString = "";
// placeholder for code when I get the query worked out
return oString;
}