Find files in web folder using vbScript (1 Viewer)

elliotgr

Registered User.
Local time
Today, 13:38
Joined
Dec 30, 2010
Messages
67
How do I list all files in a web folder when the page loads?
I am trying the following code, but I cannot determine the path (strPath) of the webpage.

Code:
<head>
<script language = "vbscript">
public Sub RunScript()
     Dim objFSO, objFldr
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFldr = objFSO.GetFolder(strPath)
    For Each objFl in objFldr.Files
           Response.Write objFl.Name
    Next
      Set objFSO = Nothing
    Set objFldr = Nothing
End Sub
</script>
</head>
<body onload="vbscript:RunScript()">
 

the_net_2.0

Banned
Local time
Today, 05:38
Joined
Sep 6, 2010
Messages
812
I don't know vb script via ASP extensions, but I can tell you that I would doubt this would be possible, because the availability of something like that would be a security threat to the server and domain.
 

elliotgr

Registered User.
Local time
Today, 13:38
Joined
Dec 30, 2010
Messages
67
Thanks, it did not work using vbScript, but by using the code 'as is' in HTML it worked, security threat or not. Thanks for the reply
 

Users who are viewing this thread

Top Bottom