asp遍历目录及子目录的函数
发布时间:2016-12-29 来源:查字典编辑
摘要:
<%@Language=vbscript%>
<%
'遍历目录以及目录下文件的函数
%>
<%
FunctionBianli(path)
SetFso=server.createobject("scripting.filesystemobject")
OnErrorResumeNext
SetObjfolder=fso.getfolder(path)
SetObjsubfolders=objfolder.subfolders
ForEachObjsubfolderInObjsubfolders
Nowpath=path+""+Objsubfolder.name
Response.writeNowpath
SetObjfiles=objsubfolder.files
ForEachObjfileInObjfiles
Response.write"<br>---"
Response.writeObjfile.name
Next
Response.write"<p>"
Bianli(nowpath)'递归
Next
SetObjfolder=nothing
SetObjsubfolders=nothing
SetFso=nothing
EndFunction
%>
<%
Bianli("D:")'遍历d:盘
%>