How do I find the parent directory in C#?

You can use System.IO.Directory.GetParent() to retrieve the parent directory of a given directory.


string parent = System.IO.Directory.GetParent(str_directory).FullName;

See BOL