PHP
code:
<%
Function Bianli (PATH)
SET FSO = Server.createObject ("scripting.filesystemObject")
ON Error ResMe next
Set objfolder = fso.getfolder (PATH)
Set objsubfolders = Objfolder.subfolders
For Each Objsubfolder In Objsubfolders
NowPath = PATH "/" Objsubfolder.name
Response.write nowpath
Set Objfiles = Objsubfolder.files
For Each Objfile in Objfiles
Response.write "
---"
Response.write objfile.name
NEXT
Response.write "
"
Bianli (nowPath) 'recursive
NEXT
Set objfolder = Nothing
Set objsubfolders = Nothing
SET FSO = Nothing
END FUNCTION
%>
<%
Bianli ("D:") 'Traversing D: Disc
%>
<% Function bianli (path) set fso = server.CreateObject ( "scripting.filesystemobject") on error resume nextset objFolder = fso.GetFolder (path) set objSubFolders = objFolder.Subfoldersfor each objSubFolder in objSubFolders nowpath = path "/" objSubFolder.nameResponse.Write nowpathset objFiles = objSubFolder.Filesfor each objFile in objFilesResponse.Write "
---" Response.Write objFile.namenextResponse.Write "
" bianli (nowpath) 'recursive next set objFolder = nothingset objSubFolders = NothingSet Fso = Nothingend Function%> <% Bianli ("D:") 'Traversing D: Disc%>