Get parent directory of parent directory

You can use the System.IO.DirectoryInfo class:

DirectoryInfo networkDir=new DirectoryInfo(@"\\Path\here\now\username");
DirectoryInfo twoLevelsUp=networkDir.Parent.Parent;

Leave a Comment