<script language="javascript" type="text/javascript">
function showFolder(objFolder)
{
if (document.getElementById(objFolder).style.display == "none")
{
document.getElementById(objFolder).style.display = "block";
}
else
{
document.getElementById(objFolder).style.display = "none";
}
}
</script>
<%
Dim intFolderID
Function GetUrl(strPath)
Dim strUrl
strUrl = Right(strPath, Len(strPath) - Len(Server.MapPath("/")))
strUrl = Replace(strUrl, "\", "/")
GetUrl = strUrl
End function
Sub ListFolder(objFolder)
Response.Write("<b>" & objFolder.Name & "</b>")
Response.Write("<ul>")
Response.Write("<li>Subfolders: " & objFolder.SubFolders.Count & "</li>")
Response.Write("<li>Files: " & objFolder.Files.Count & "</li>")
Response.Write("<li>Total size: " & Round((objFolder.Size / 1024), 2) & " kilobytes</li>")
Response.Write("</ul>")
End Sub
Sub ListSubFolders(objFolder)
Dim objSubFolder
For Each objSubFolder in objFolder.SubFolders
intFolderID = intFolderID + 1
Response.Write("<li><a href=""javascript: showFolder('" & intFolderID & "');"">" & objSubFolder.Name & "</a> - " & Round((objSubFolder.Size / 1024), 2) & " kilobytes</li>")
Response.Write("<ul id=""" & intFolderID & """ style=""display: none;"">")
ListSubFolders(objSubFolder)
ListFiles(objSubFolder)
Response.Write("</ul>")
Next
Set objSubFolder = Nothing
End Sub
Sub ListFiles(objFolder)
Dim objFile
For Each objFile In objFolder.Files
Response.Write("<li><a href=""" & GetURL(objFile.Path) & """>" & objFile.Name & "</a> - " & Round((objFile.Size / 1024), 2) & " kilobytes</li>")
Next
Set objFile = Nothing
End Sub
Sub ListFolderContents(strPath)
Dim objFso, objFolder
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder(strPath)
ListFolder(objFolder)
Response.Write("<b>Content</b>")
Response.Write("<ul>")
ListSubFolders(objFolder)
ListFiles(objFolder)
Response.Write("</ul>")
Set objFolder = Nothing
Set objFso = Nothing
End Sub
ListFolderContents(Request.QueryString("txtPath"))
%>