C# directory get folders code example
Example 1: get directory of file c#
using System.IO;
string file = "C:\Documents\file.txt";
Path.GetDirectoryName(file);
Example 2: get folders in directory c#
string[] folders = System.IO.Directory.GetDirectories(@"C:\My Sample Path\","*", System.IO.SearchOption.AllDirectories);