Hi Gang, I have written a little page for our intranet that just spits all of the contents of a folder onto a webpage w/links so that I don't have to maintain it when marketing adds docs, etc. Well, what I'd like to do is make it recursive, so if they add subfolders, it will also list them and their contents. I can see how to hardcode it, but how could I loop it so that they can add N number of subdirectories? I had thought about listing just the subfolder names and then having them click the name and have it load the same ASP page showing a difft directory, files, and subfolders, but for now, I'd like to have it on the same page. Here's the current code I'm using to get a folder, its files and subdirs.
Thanks a bunch!
-Scott
Code:
<%
Dim fso, folder, folderspec, path, link, docs, subs
folderspec="c:/"
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(folderspec)
Set subs = folder.subfolders
For Each FileName In folder.files
link = "xxx"
Response.write "<a href=""" & link & """>" & fileName.name & "</a><br>"
Next
response.write "<b>Subfolders:<br></b>"
For Each FolderName In subs
response.write folderName.name & "<br>"
Next
set subs = nothing
set folder = nothing
set fso = nothing
%>
Thanks a bunch!
-Scott