I am having the following path on the string Say "C:\\Test\\SubTest\\a.jpg".
I need to seperate the folder name and file name seperatly.
Thanks.
There's built in method in the System.IO.Path class
string fileName = System.IO.Path.GetFileName("C:\\Test\\SubTest\\a.jpg");
By this i can get only the filename seperatly.
But i need the folder name with it.
There are 2 folders in that path which folder name you need?
I need to store the folder name in a list or string.
Can you be specific in what you want to do?
In your path there are 2 folders Test and SubTest? Which you want ?
Or give me an example what you need in the output string
Since this will save time and you will get answer quickly
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.