By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,327 Members | 1,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,327 IT Pros & Developers. It's quick & easy.

Remove folder name after \

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
"Brent" <br****@yahoo.com> wrote in message
news:ad**************************@posting.google.c om...
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

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.