<%
'Retrieve the requested path (local) from the url
strDir = Request("strPath")
If strDir = "" Then strDir = Server.MapPath("/")
strParse = strDir
'Make sure that there is a trailing "\" On the path (directory)
If Right(strParse, 1) <> "\" Then strParse = strParse & "\"
'Path starts out as something like: "c:\winnt\system32\cache"
'What we have To Do is Loop through the String and parse out Each chunk
'at the backslashes "\". Each time we loop, we remove the "\"s and
'prepend a couple of spaces To the beginning of the String to simulate
'the indented "sub directory" look. Then we write it out With eithere
'an opened or closed folder. Here we go....
'Find out where the first "\" is
lngPos = InStr(1, strParse, "\")
'Write out a link To submit this new path back to this page If the user clicks this folder
strOut = "
" & Left(strParse, lngPos) & "
"
'Loop thru all of the rest of the sub-directories ("\")
x = 2
Do While lngPos <> 0
oldPos = lngPos
lngPos = InStr(oldPos + 1, strParse, "\")
If lngPos = 0 Then Exit Do
'Use spaces To simulate indentation of sub-dirs
For y = 1 To x
strIndent = strIndent & " "
Next 'y
strOut = strOut & strIndent & "
" & Mid(strParse, oldPos + 1, lngPos - (oldPos + 1)) & "
"
'Jump up the nubmer of spaced (indenting)
x = x + 2
'Are we at the end? Exit If we are
If lngPos = Len(strParse) Then Exit Do
Loop
'Here we start the left hand side of our "Explorer" view
Response.Write("")
'Write out our monolithic String of folders
Response.Write(strOut)
strIndent = strIndent & " "
'Now we need To Get the subdirectories of the _current_ folder ...
'Get all the required FileSystemObjects Set up. Pass In strDir
Set objFSObject = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSObject.GetFolder(strDir)
'Get the subfolders
Set colFolders = objFolder.SubFolders
'Now we Loop through all of the subdirectories
'and write the names/hyperlinks To the html
For Each intFol in colFolders
strFName = intFol.name
Response.Write(strIndent & " " & strFName &" " & vbcrlf)
Next 'intFol
Response.Write(" | ")
'Ok, now... On To the files In this directory
Response.Write("")
'Same basic idea as the subfolders, but we handle a 'file click'
'on a different page (WebXplorer2.asp), so make the link go there
Set colFiles = objFolder.Files
Response.Write("")
'Loop through Each file, construct the image, url, and name
'and write them out To the html stream using Response.Write
For Each intF1 in colFiles
strFName = intF1.name
response.write " " & strFName &" | "
Next 'intF1
Response.Write(" | ")
%>