pages/parentdirectory/directory
如何在C#中提取父目录?
答案 0 :(得分:0)
您可以使用Directory.GetParent。 ..返回DirectoryInfo,您可以获取Name或FullName
var info = Directory.GetParent(@"directory_path");
var name = info.Name; //this will give parentdirectory
var fullName = info.FullName; //this will give pages/parentdirectory