I borrowed the below code from http://www.brainjar.com/asp/dirlist/ and
cannot get it to read my folder files. I don't get any errors or any output
to screen. I have the below folder permissions set to browse. Without using
the below page, I can browse the files. What did I miss?
thanks!
<%@LANGUAGE="VB SCRIPT" CODEPAGE="1252" %>
<% set fs = CreateObject("S cripting.FileSy stemObject")
set folder = fs.GetFolder("c :\inetpub\wwwro ot\bs\aa\")
%>
<% function MapURL(path)
dim rootPath, url
'Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath( "/")
url = Right(path, Len(path) - Len(rootPath))
MapURL = Replace(url, "\", "/")
end function %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitl ed Document</title>
</head>
<body>
<% sub ListFolderConte nts(path)
dim fs, folder, file, item, url
set fs = CreateObject("S cripting.FileSy stemObject")
set folder = fs.GetFolder(pa th)
'Display the target folder and info.
Response.Write( "<li><b>" & folder.Name & "</b- " _
& folder.Files.Co unt & " files, ")
if folder.SubFolde rs.Count 0 then
Response.Write( folder.SubFolde rs.Count & " directories, ")
end if
Response.Write( Round(folder.Si ze / 1024) & " KB total." _
& "</li>" & vbCrLf)
Response.Write( "<ul>" & vbCrLf)
'Display a list of sub folders.
for each item in folder.SubFolde rs
ListFolderConte nts(item.Path)
next
'Display a list of files.
for each item in folder.Files
url = MapURL(item.pat h)
Response.Write( "<li><a href=""" & url & """>" _
& item.Name & "</a- " _
& item.Size & " bytes, " _
& "last modified on " & item.DateLastMo dified & "." _
& "</li>" & vbCrLf)
next
Response.Write( "</ul>" & vbCrLf)
end sub %>
</body>
</html>