[Solved] Determining the Parent Folder of a given Path in C#


You can use Directory.GetParent. .. which returns a DirectoryInfo and you can get the Name or FullName

var info = Directory.GetParent(@"directory_path");
var name = info.Name; //this will give parentdirectory
var fullName = info.FullName; //this will give pages/parentdirectory

solved Determining the Parent Folder of a given Path in C#