Directory.GetFiles(targetDirectory);
Using the code above, we get the names ( i.e. the full path) of all the files in the directory. but I need to get only the file name, not the path. So, how can I get the name of only the files except the path? Or do I need to perform string operations when deleting an unwanted part?
EDIT:
TreeNode mNode = new TreeNode(ofd.FileName, 2, 2);
Here ofd is OpenFileDialog , and ofd.FileName indicates the name of the file along with Path, but I only need the file name.
source share