How do I get a parent of a directory, for example:
string upDir = GetOneLvlUp(@\"C:\\AAA\\BBB\\CCC\\DDD\\\");
Output: C:\\AAA\\BBB\\CCC\\
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string parentDir = Directory.GetParent(path).FullName;
var upDir = new DirectoryInfo(yourPath).Parent.FullName;
upDir = Directory.GetParent(path).FullName;
Everything you want is in the Directory class:
http://msdn.microsoft.com/en-us/library/system.io.directory.aspx
In particular, GetParent:
http://msdn.microsoft.com/en-us/library/system.io.directory.getparent.aspx