asp遍历目录及子目录的函数
编程学习 2021-07-05 10:58www.dzhlxh.cn编程入门
asp遍历目录以及目录下文件的函数- 从网上找的不过都用不了,自己用Emeditor修正了一下
<%@ Language=vbscript %>
<%
'遍历目录以及目录下文件的函数
%>
<%
Function Bianli(path)
Set Fso=server.createobject("scripting.filesystemobject")
On Error Resume 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 "<br>---"
Response.write Objfile.name
Next
Response.write "<p>"
Bianli(nowpath)'递归
Next
Set Objfolder=nothing
Set Objsubfolders=nothing
Set Fso=nothing
End Function
%>
<%
Bianli("D:") '遍历d:盘
%>
<%
'遍历目录以及目录下文件的函数
%>
<%
Function Bianli(path)
Set Fso=server.createobject("scripting.filesystemobject")
On Error Resume 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 "<br>---"
Response.write Objfile.name
Next
Response.write "<p>"
Bianli(nowpath)'递归
Next
Set Objfolder=nothing
Set Objsubfolders=nothing
Set Fso=nothing
End Function
%>
<%
Bianli("D:") '遍历d:盘
%>
上一篇:vbs或asp采集文章时网页编码问题
下一篇:asp生成不需要数据库的中奖码