If you have a path as a string, you can use this method to extract the lower level directory:
String dir = yourPath.Substring( yourPath.LastIndexOf(Path.DirectorySeparatorChar) + 1);
Since this code uses Path.DirectorySeparatorChar , it is platform independent.
source share