Create a dynamic ASP file view - TechRepublic
General discussion
March 19, 2003 at 02:23 AM
vfarina

Create a dynamic ASP file view

by vfarina . Updated 23 years, 2 months ago

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 =

  • ” & pfolder.Name

    If pfolder.SubFolders.Count > 0 Or pfolder.Files.Count > 0 Then _
    sFolders = sFolders & “

      For Each fldr In pfolder.SubFolders sFolders = sFolders & GetSubFolders(fldr)
      Next

      For Each fil In pfolder.Files
      sFolders = sFolders & “

    • ” & fil.Name & “

    • 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.

    This discussion is locked

    All Comments