您的位置:首页 > 其它

fso遍历某一目录下所有文件的函数

2004-11-09 10:55 543 查看
<%
function bianli(path)
set fso=server.CreateObject("scripting.filesystemobject") </P><P>on error resume next
set objFolder=fso.GetFolder(path)</P><P>set objSubFolders=objFolder.Subfolders</P><P>for each objSubFolder in objSubFolders </P><P>nowpath=path + "/" + objSubFolder.name</P><P>Response.Write nowpath</P><P>set objFiles=objSubFolder.Files</P><P>for each objFile in objFiles
Response.Write "<br/>---"
Response.Write objFile.name
next
Response.Write "<p>"
bianli(nowpath)'递归</P><P>next
set objFolder=nothing
set objSubFolders=nothing
set fso=nothing
end function
%>
<%
bianli("d:") '遍历d:盘
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  function path each