我如何獲得一個目錄的父,例如:你想如何找到路徑的父目錄?
string upDir = GetOneLvlUp(@"C:\AAA\BBB\CCC\DDD\");
Output: C:\AAA\BBB\CCC\
我如何獲得一個目錄的父,例如:你想如何找到路徑的父目錄?
string upDir = GetOneLvlUp(@"C:\AAA\BBB\CCC\DDD\");
Output: C:\AAA\BBB\CCC\
upDir = Directory.GetParent(path).FullName;
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string parentDir = Directory.GetParent(path).FullName;
可能的重複[如何在C#中找到父目錄?](http://stackoverflow.com/questions/6875904/how-do-i-find-the-parent-directory-in-c) – bfavaretto 2012-07-10 00:44:43