find the parent directory

 




            System.IO.DirectoryInfo myDirectory = new DirectoryInfo(path); //  D:\doc\CAD\a.txt

            string fatherDir = myDirectory.Parent.Name; //CAD

            string grandfatherDir = myDirectory.Parent.Parent.Name;//doc

留言

熱門文章