This code will display all subfolders and files of whatever directory it's in. It uses the FileSystemObject to get the directory contents, and displays each item as a link. This is a perfect solution for building an image gallery with ASP.
By default this script will not display any hidden folders. If you want to change that, take out the if statement that looks for Attribute 18. If you want this script to work recursively to display the contents of subfolders, just save it as 'default.asp' in each folder and subfolder.
<%
dim objFSO, strFile, objFile, objFiles, objFolder, objSubFolders, subfolder, file
set objFSO = Server.CreateObject("Scripting.FileSystemObject")
strFile = Request.ServerVariables ("PATH_TRANSLATED")
set objFile = objFSO.GetFile(strFile)
set objFolder = objFile.ParentFolder
set objSubFolders = objFolder.SubFolders
set objFiles = objFolder.Files
response.Write("<p>Directory contents as of " & now() & "</p>")
For each subfolder in objSubFolders
if subfolder.Attributes <> 18 then
Response.Write("<a href=""" & subfolder.Name & """>" & subfolder.Name & "</a><br />")
end if
next
response.write("<hr>")
For each file in objFiles
if file.Attributes <> 18 then
Response.Write("<a href=""" & file.Name & """>" & file.Name & "</a><br />")
end if
next
set objFSO = nothing
set strFile = nothing
set objFile = nothing
set objFolder = nothing
set objSubFolders = nothing
set objFiles = nothing
%>