ASP,F(xiàn)SO遍歷目錄及目錄下文件
更新時(shí)間:2006年10月28日 00:00:00 作者:
<%@ Language=VBScript %>
<%
'我寫(xiě)的一個(gè)遍歷目錄以及目錄下文件的函數(shù),
%>
<%
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:盤(pán)
%>
<%
'我寫(xiě)的一個(gè)遍歷目錄以及目錄下文件的函數(shù),
%>
<%
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:盤(pán)
%>
相關(guān)文章
寫(xiě)入文本文件的過(guò)程函數(shù)(ASP)
寫(xiě)入文本文件的過(guò)程函數(shù)(ASP)...2006-10-10asp(vbs)fso OpenTextFile方法參數(shù)說(shuō)明
OpenTextFile是asp語(yǔ)言中的一個(gè)方法,打開(kāi)指定的文件并返回一個(gè) TextStream 對(duì)象,可以通過(guò)這個(gè)對(duì)象對(duì)文件進(jìn)行讀、寫(xiě)或追加2015-04-04