Remove folder name after \

  • Thread starter Thread starter Brent
  • Start date Start date
B

Brent

This one should be pretty easy, but I just can't figure it out. I am
receiving a folder path into a string variable. I need to remove the
folder name after the last slash. What is the easiest way to do this?

Example: "C:\My Documents\Folder"

I need to put Folder into a new variable and remove th C:\My
Documents\

Thanks in advance

Brent
 
Dim s1 As String = System.IO.Path.GetDirectoryName("C:\My Documents\Folder")

s1 will be "C:\My Documents"

Dim s2 As String = System.IO.Path.GetFileName("C:\My Documents\Folder")

s2 will be "Folder"

Greg
 
Back
Top