bmwmpower
04-23-2003, 03:48 PM
i have problem in the path for every subfolder in the folder
for example
i have folder ( xxx) and in this folder i have subfolder (yyy) and in this subfolder i have subfolder (ttt)
the problem is when i make all this folde linked i see problem in the path
i mean the path for folder ttt is ( xxx/ttt ) this is the problem
this is my code to display the folder and all subfolder
<%@ LANGUAGE="VBScript" %>
<%
Response.CacheControl = "Private"
c=session("node")
f=request("f")
f2=request("f2")
sub ListFolderContents(path)
dim fs, folder, file, item, url
set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)
url = MapURL(folder.path)
Response.Write("<img src='imgs\folder.gif'alt='Open' border='0'> <font class=dnb-link-light-bg><a href='shearfol.asp?f=" & f & + "&c=" & c + "\" + folder.Name & + "&f2=" & f2 &"'>" & folder.Name & "</a></font>" & vbCrLf)
Response.Write("<ul>" & vbCrLf)
'Display a list of sub folders.
for each item in folder.SubFolders
ListFolderContents(item.Path)
url = MapURL(item.path)
next
''Display a list of files.
Response.Write("</ul>" & vbCrLf)
Response.Write("</li>" & vbCrLf)
end sub
function MapURL(path)
dim rootPath, url
'Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath(c)
'on error resume next
url=path
MapURL = Replace(url, "\", "/")
end function
and i found the answer but i need help in how i can Convert a physical folder path to virtual path
example
convert this path= C:\Inetpub\wwwroot\NBCBN\admin\ssss
to this path=admin\ssss
how ??????????
for example
i have folder ( xxx) and in this folder i have subfolder (yyy) and in this subfolder i have subfolder (ttt)
the problem is when i make all this folde linked i see problem in the path
i mean the path for folder ttt is ( xxx/ttt ) this is the problem
this is my code to display the folder and all subfolder
<%@ LANGUAGE="VBScript" %>
<%
Response.CacheControl = "Private"
c=session("node")
f=request("f")
f2=request("f2")
sub ListFolderContents(path)
dim fs, folder, file, item, url
set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)
url = MapURL(folder.path)
Response.Write("<img src='imgs\folder.gif'alt='Open' border='0'> <font class=dnb-link-light-bg><a href='shearfol.asp?f=" & f & + "&c=" & c + "\" + folder.Name & + "&f2=" & f2 &"'>" & folder.Name & "</a></font>" & vbCrLf)
Response.Write("<ul>" & vbCrLf)
'Display a list of sub folders.
for each item in folder.SubFolders
ListFolderContents(item.Path)
url = MapURL(item.path)
next
''Display a list of files.
Response.Write("</ul>" & vbCrLf)
Response.Write("</li>" & vbCrLf)
end sub
function MapURL(path)
dim rootPath, url
'Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath(c)
'on error resume next
url=path
MapURL = Replace(url, "\", "/")
end function
and i found the answer but i need help in how i can Convert a physical folder path to virtual path
example
convert this path= C:\Inetpub\wwwroot\NBCBN\admin\ssss
to this path=admin\ssss
how ??????????