To fetch only the file name

Hey,

i have a file abc.txt.

I want to fetch only the file name i.e. abc and not the extension

Thanks in advance!

If MyPath is the path to the file, use System.IO.Path.GetFileNameWithoutExtension(MyPath).

2 Likes

Yes, Iā€™d forgotten the Path part.

This will have the extension
i use
Eg: item=abc.txt
Path.GetFileName(item)

You missed the full name :slight_smile: GetFileNameWithoutExtension

got it.
Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.