View Full Version : Find files in web folder using vbScript


elliotgr
02-24-2011, 01:48 AM
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.


<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
02-24-2011, 08:02 PM
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
02-24-2011, 09:16 PM
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