Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Manipulation...

Status
Not open for further replies.

imstillatwork

IS-IT--Management
Sep 26, 2001
1,605
US
I get my path like this...

Server.mappath(Request.ServerVariables("Script_Name"))

results something like:

C:\ASP\intranet\test\path.asp

How do manipulate that string to just have the last subfolder in the path? ei:

test

So that no matter what folder I put this script in, it will use that folder name as a variable in the script. (I am using a server.include to reuse "this_script.inc" from one location in many pages in differen folders)

make sense? I have never worked with string manipulate before, but i know it can do a lot...

Thanks

 
arrPath = Split(Server.mappath(Request.ServerVariables("Script_Name")), "\")
lastfoldername = arrPath(UBound(arrPath)-1)

' to ensure you have the right foldername....
response.write (lastfoldername)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top