ASP substring

Hello,

I need to extract the folder from the filepath. The filepath is as follows:
/Files/Letters/Letters1.asp

What I need from this is:
/Files/Letters/

What is the easy way to do this??
Thank you
lathashankarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
try:

str = "/Files/Letters/Letters1.asp"
path = Left(str, Len(str) - InStrRev(str, "/")-2)

B.D.
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
sorry, should be:

str = "/Files/Letters/Letters1.asp"
path = Left(str, Len(str) - InStrRev(str, "/")+2)

B.D.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hongjunCommented:
try this

<%
Dim str

str = "/Files/Letters/Letters1.asp"
Response.Write Left(str, InStrRev(str, "/"))
%>
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

hongjunCommented:
There's no need to use the Len function here.
Think mine http:#13460564 is sufficient and simpler.


hongjun
0
lathashankarAuthor Commented:
Thank you both for your immediate assistance
0
lathashankarAuthor Commented:
How do I get just the name of the file??
0
hongjunCommented:
@lathashankar
This is a second question and strictly speaking, you should post another question.
But I will post the solution here anyway. If you wish to award me points for this second question, you can do so by opening a new ASP question titled "points to hongjun" and stating it is because of this question :) But if you do not wish to open another question, it's still okay.

<%
Dim str

str = "/Files/Letters/Letters1.asp"
Response.Write Right(str, Len(str) - InStrRev(str, "/"))
%>

hongjun
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.