Remove one directory from full directory path
c#
Solution
Directory.GetParent(dir).FullName
Problem
I have a directory path of `C:\Subdir1\Subdir2\Subdir3\filename.xml`. I need to first check if the file, `filename.xml` exists in the root of `"Subdir2"` (one level back) before looking in `"Subdir3"`. How can I easly parse this with `Path.GetPathRoot(filename)`? I.E. First see if this is true: C:\Subdir1\Subdir2\filename.xml If not true, then default to `C:\Subdir1\SubDir2\Subdir3\filename.xml` for the file.