How do I know the number of folders inside a directory?
I try using System.IO.Directory but no luck.
System.IO.Directory
Use:
Directory.GetDirectories(@"C:\").Length
of course instead of @"C:\" you use whatever path you want to know the sub-directory count for. The method also has overloads to allow searching for a specific pattern and searching recursively.
@"C:\"