fso遍歷某一目錄下所有文件的函數

<%
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:盤
%>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章