Remove "slashes" from file path

I have file path which has lots of “slashes”. how to remove all slashes from file path and get only file name out…

feks.
C:\Program Files\Lenovo\HOTKEY\zh-CN\text.dll

I need text.dll out.

Hi @Ellen

Path.GetFileName(filePath)

Cheers!!

1 Like

@Ellen

Cheers!!

Hi @Ellen

You can get the file name by this way:
Path.GetFileName(filepath.ToString)

No, if you are going to use the filepath somewhere else then you can do it this way
filename = "C:\Program Files\Lenovo\HOTKEY\zh-CN\text.dll"
Output = filename.Split("\").Last

Hope it helps!!

Thanks a lot.
Issue solved.

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