You can use the overload of Directory.GetDirectories
string[] plcDirs = Directory.GetDirectories(@"C:\Test", "PLC*", SearchOption.TopDirectoryOnly);
if(plcDirs.Any())
{
// ...
}
If there are many sub-directories it is more efficient to use the deferred executed EnumerateDirectories
which does not need to load all into memory before it can start processing:
var plcDirs = Directory.EnumerateDirectories(@"C:\Test", "PLC*", SearchOption.TopDirectoryOnly);
MSDN:
The EnumerateDirectories and GetDirectories methods differ as follows:
When you use EnumerateDirectories, you can start enumerating the
collection of names before the whole collection is returned; when you
use GetDirectories, you must wait for the whole array of names to be
returned before you can access the array. Therefore, when you are
working with many files and directories, EnumerateDirectories can be
more efficient.