Option Explicit
Dim InfoPath ' Current Path
Dim Serverpath ' Server Path
Dim objFSO ' File Component
Dim objfile ' File
Dim objfolder ' Directory
Dim objfoldercontents ' All Files
Dim objfoldercount ' Temporary Array variable-folder
Dim objfileitem ' Temporary Array variable-file
Infopath=request.servervariables ("Path_info") ' gets file relative path
Serverpath=server.mappath (InfoPath) ' Get file absolute path
set objfso=createobject ("Scripting.FileSystemObject") ' instance file components
set objfile=objfso.getfile (serverpath) ' Read the path to the file
set objfolder=objfile.parentfolder ' Gets the ancestor directory according to the path of the file;
Set Objfoldercontents=objfolder.files ' All files paid to array
For each objfileitem in objfoldercontents ' Loop
Response.Write ("http://www.111cn.net/" & objfileitem.name& "<br/>") ' filename
Next
' Code two
Set fso = Server.CreateObject ("Scripting.FileSystemObject")
If Fso.folderexists (Request ("filepath")) then
Set objfolder = Fso.getfolder (Request ("filepath"))
For each objfile in Objfolder.files
Response.Write Objfile.name
Next
Set objfolder = Nothing
Set fso = Nothing
' This will show all files, but not folders
%>