ASP,FSO遍历目录及目录下文件
程序员文章站
2022-04-14 20:24:29
<%@ language=vbscript %>
<%
'我写的一个遍历目录以及目录下文件的函数,
%>
<%
functio...
<%@ 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:盘
%>
上一篇: Asp类 的数据库领域
下一篇: 晚上吃瘦肉会长胖吗?在减肥中的你有福利啦