I have this path:
C:\SomeFolder\Folder1\file.txt
How do I get the name "Folder1"?
There are no GetFolderName function, only directory name :confused:
Printable View
I have this path:
C:\SomeFolder\Folder1\file.txt
How do I get the name "Folder1"?
There are no GetFolderName function, only directory name :confused:
A "Directory" is what we use to call a folder back before GUIs came along with their desktop metaphor.
Path.GetFileName gets the leaf node from the path and Path.GetDirectoryName gets the rest. Call GetDirectoryName first to trim off the last node and create a new path, then call GetFileName to get the last node of that.
Thank you, it worked.