网站制作学习网ASP→正文:asp遍历文件
字体:

asp遍历文件

ASP 2008/12/1 8:38:04  点击:不统计

asp遍历文件asp遍历文件代码



<%@ Language=VBScript %>

<%

function bianli(path)

dim fso 'fso对象

dim objFolder '文件夹对象

dim objSubFolders '子文件夹集合

dim objSubFolder '子文件夹对象

dim objFiles '文件集合

dim objFile '文件对象



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

%>

<%pa= request.ServerVariables("APPL_PHYSICAL_PATH")

bianli(pa)

%>



·上一篇:中国ip段 >>    ·下一篇:年月日转换成大写 >>
推荐文章
最新文章