Method Path2.GetDirectory
Overload
Gets the parent directory path from path.
Examples: @"C:\path\name.ext" -> @"C:\path"; @"C:\path\name\" -> @"C:\path"; @"C:\path" -> @"C:\"; @"name.ext" -> null.
public static string GetDirectory(string path, bool withSeparator = false)
Parameters
|
path (string)
Path or filename. Can be |
|
withSeparator (bool)
Don't remove path separator character(s) at the end of the result. |
Returns
|
string
|
Remarks
Calls System.IO.Path.GetDirectoryName, after removing trailing directory separators from path.