Create a dynamic ASP file view
In regards to the article written by Phillip Perkins in the 3/18/03 Newsletter.
I copied the code in the email, just as it appeared, the only thing I changed was the directory it browses. It gives me a "Type Mismatch Error" on the Sub Procedure "GetSubFolders".
' -- Here is the code --
Dim sPath, fso, folder
sPath = "C:\Data\Images"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(sPath)
Response.Write "
- " & GetSubFolders(folder) & "
"Sub GetSubFolders(pfolder)
Dim sFolders, fldr, fil
sFolders = "
If pfolder.SubFolders.Count > 0 Or pfolder.Files.Count > 0 Then _
sFolders = sFolders & "
- "
- " & fil.Name & "
For Each fldr In pfolder.SubFolders sFolders = sFolders & GetSubFolders(fldr)
Next
For Each fil In pfolder.Files
sFolders = sFolders & "
"
Next
If pfolder.SubFolders.Count > 0 Or pfolder.Files.Count > 0 Then _ sFolders = sFolders & "
"
sFolders = sFolders & "
"
Set fil = Nothing
Set fldr = Nothing
GetFolder = sFolders
End Sub
Any help would be appreciated.