<%@language="vbscript" codepage="65001" lcid="2052"><%response.codepage="65001":response.charset="utf-8":response.lcid="2052"%><% dim phy_dir phy_dir = "E:\asp________www\2023年03月\20230324大德重工\ziliao" call get_templatefile_list(phy_dir,1,1) '遍历文件夹获取文件列表 '遍历指定目录下的数据 sub get_templatefile_list(path,pid,id) dim i i=0 set fso=server.createobject("scripting.filesystemobject") on error resume next set objfolder=fso.getfolder(path) if pid = 1 then nowpath=path set objfiles=objfolder.files dirfile_id = 2 for each objfile in objfiles response.write "文件:" + nowpath + "\" + objfile.name response.write " " dirfile_id = dirfile_id+1 next end if set objsubfolders=objfolder.subfolders for each objsubfolder in objsubfolders i = i + 1 id = i*10 + i nowpath=path + "\" + objsubfolder.name response.write "文件夹:" + nowpath response.write " " set objfiles=objsubfolder.files for each objfile in objfiles response.write "文件:" +nowpath + "\" + objfile.name response.write " " next call get_templatefile_list(nowpath,id,id+1) '递归 next set objfolder=nothing set objsubfolders=nothing set fso=nothing end sub %>