C# – get directory from full path

c++directory

If i have:

C:\temp\foo\bar\

(NOTE: bar is a directory)

how can i parse out:

bar

Best Solution

I figured it out.

DirectoryInfo info = new DirectoryInfo(sourceDirectory_);
string currentDirectoryName = info.Name;