Sub bianli(path)
dim objFolder '文件夹对象
dim objSubFolders '子文件夹集合
dim objSubFolder '子文件夹对象
dim objFiles '文件集合
dim objFile '文件对象
dim Fso
on error resume next
Set Fso=server.CreateObject("scripting.filesystemobject")
set objFolder=Fso.GetFolder(path)'创建文件夹对象
set objFiles=objFolder.Files
for each objFile in objFiles
Response.Write path&"\"&objFile.name&"<br>"&vbcrlf
next
set objSubFolders=objFolder.Subfolders'创建的子文件夹对象
for each objSubFolder in objSubFolders
nowpath=path & "\" & objSubFolder.name
bianli(nowpath) '调用递归
next
set objFolder=nothing
set objSubFolders=nothing
set Fso=nothing
End Sub
转载于:https://www.cnblogs.com/hanwater/archive/2010/03/13/1684904.html