Get Parent Directory

Returns the parent directory of a given path:

/// <summary>
/// Returns the parent path of the given path
/// </summary>
/// <param name="path"></param>
public static string GetParentDirectory(String path)
{
    DirectoryInfo parent = Directory.GetParent(path);
    return parent.FullName;
}

For example c:\temp\backschnupps will return c:\temp</code>

Werbung



comments powered by Disqus

Copyright Dunkel & Iwer GbR | Datenschutzerklärung | Impressum