function bianli(path)
set fso=createobject("scripting.filesystemobject")
on error resume next
set objFolder=fso.GetFolder(path)
set objSubFolders=objFolder.Subfolders
for each objSubFolder in objSubFolders
if right(path,1)<>"\" then
nowpath=path + "" + objSubFolder.name
else
nowpath=path + objSubFolder.name
end if
Response.Write nowpath
set objFiles=objSubFolder.Files
for each objFile in objFiles
Response.Write "<br>"
Response.Write objFile.name
next
Response.Write "<hr>"
if objSubFolder.attributes<>16 then bianli(nowpath)
'bianli(nowpath)
next
Response.Write path1
for each objFile1 in objFolder.Files
Response.Write "<br>"
Response.Write objFile1.name
next
Response.Write "<hr>"
set objFolder=nothing
set objSubFolders=nothing
set fso=nothing
end function
bianli("D:myweb")
------------------------------
Dim objFSO,objFolder,objFile,FF '声明 objFSO 变量存放对象实例
FF = Server.MapPath("./images")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(ff) Then
Response.write "文件夹 "&ff&" 里所有的文件:<br>"
Set objFolder = objFSO.GetFolder(ff)
For Each objFile in objFolder.Files
Response.Write objFile.Name & "<br>"
Next
Else
Response.Write "文件夹"&ff&"不存在,无法读取相关信息!"
End If
Set objFolder = Nothing
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间