Recursive File and Directory List Function
Click here
to test this script.
Code:
Highlight
<%option explicit%> <% dim rootDir, fso set fso = server.CreateObject ("Scripting.Filesystemobject") set rootDir = fso.Getfolder(server.MapPath("./")) listDirectory rootDir set fso = nothing %> <% Function listDirectory(objrootDir) Dim objSubFolder Dim objFile for each objSubFolder in objrootDir.SubFolders if not objSubFolder.name = "_vti_cnf" then response.write "
" & objSubFolder.name & "
" & vbcrlf response.write "
" & vbcrlf for each objFile in objSubFolder.Files response.write "
" & objFile.name & "
" & vbcrlf next listDirectory(objSubFolder) response.write "
" & vbcrlf & vbcrlf end if next end function %>