Hi, I'm trying to search for directories that don't match a certain criteria. I want to get just the subdirectories not starting with 'F'.
This is what I'm doing at the moment but it's not working.
var pattern = new Regex("^[^F].*");
var dirs = from d in Directory.EnumerateDirectories(Path, "*", SearchOption.TopDirectoryOnly)
This code returns all the subdirectories ignoring the filter expression.
I think it's looking at the root directory instead of looking in the subdirectories of \root. So because the root starts with 'D\' it thinks it's all good. If I change the regular expression to the one below, I get nothing.
var pattern = new Regex("^[^D].*");