c# get file's folder code example
Example 1: c# retrieve files in folder
using System.IO;
string[] filePaths = Directory.GetFiles(@"c:\MyDir\");
// returns:
// "c:\MyDir\my-car.BMP"
// "c:\MyDir\my-house.jpg"
Example 2: get directory of file c#
using System.IO;
string file = "C:\Documents\file.txt";
Path.GetDirectoryName(file);