Get folder name

Results 1 to 3 of 3

Thread: Get folder name

  1. #1
    Fred (sweden) Guest

    Default Get folder name

    I have a problem with the method GetFolder. Here´s the situation: <BR>I want to get the folder name (whatever it is at the moment) from inside a file in that same folder and place the name in a variable. Ex.<BR><BR>http://.../.../myfolder/default.asp<BR><BR>How can I get the name "myfolder" (only that name, not the whole path from the root) from inside default.asp?<BR><BR>Thanks!!!<BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    569

    Default RE: Get folder name

    Here&#039s a function to lop the file name off the URL string. You can adjust it easily so that it carries on from here and takes the next part of the string before the "/" character. Any problems email me:<BR>brian@esmart.ie<BR><BR>file_path = StripURL(Request.ServerVariables("SCRIPT_NAME"))<B R><BR><BR>&#060;%<BR>Function StripURL(path)<BR> if path &#060;&#062; "" then<BR> x = len(path)<BR><BR> Do until strfrag = "/"<BR> strfrag = mid(path,x,1)<BR> x = x - 1<BR> Loop<BR> <BR> StripURL = left(path,x)<BR> Else<BR> StripURL = "Path Not Provided"<BR> End If<BR>End Function<BR>%&#062;

  3. #3
    Fred Guest

    Default Thanks, it worked perfect!!!

    Thank you Brian, it worked perfect!!! I´ll keep your email adress for future problems.<BR><BR>/Fred

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •