c# get all directories and subdirectories code example
Example 1: get folders in directory c#
string[] folders = System.IO.Directory.GetDirectories(@"C:\My Sample Path\","*", System.IO.SearchOption.AllDirectories);
Example 2: list all files in directory and subdirectories c#
string[] entries = Directory.GetFileSystemEntries(path, "*", SearchOption.AllDirectories);