ASP Tutorial Displays directory all files
option explicit
dim infopath ' Current path
Dim serverpath ' Server path
dim objfso ' File Components
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") ' get 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
%>