显示目录下所有的文件(含文件夹)
作者:admin 日期:2009-05-15
<%
set A=server.createobject("scripting.filesystemobject")
path="G:\count\0"
i=0
response.write "主目录:<br>"&path&"<ul>"
re
response.write "</li></ul>" '-----------------主目录
sub re()
B=B&i
C=C&i
D=D&i
E=E&i
set B=A.getfolder(path) '----------------------主目录下文件
if i>=2 then response.write "<ul>"
for each E in B.files
response.write "<li>"&E.name&"</li>"
next
if i>=2 then response.write "</ul>"
'----------------------End '---------------------------主目录下文件夹 set C=B.SubFolders
if i>=2 then response.write "<ul>"
for each D in C
response.write "<li><b>"&D.name&"</b><font color=#c0c0c0>(DIR)</font>"
i=i+1
path=D
re2 '显示子目录
next
if i>=2 then response.write "</ul>"
'---------------------------End
end sub '-----------------次目录
sub re2()
B=B&i
C=C&i
D=D&i
set B=A.getfolder(path) '-----------------------------次目录下文件
response.write "<ul>"
for each E in B.files
response.write "<li>"&E.name&"</li>"
next
response.write "</ul>"
'-----------------------------End '-----------------------------次目录下文件夹
set C=B.SubFolders
response.write "<ul>"
for each D in C
response.write "<li><b>"&D.name&"</b><font color=#c0c0c0>(DIR)</font></li>"
i=i+1
path=D
re '显示子目录
next
response.write "</ul>" '-----------------------------End
end sub
%>
'引用自http://www.jscode.cn/arthtml/art4663.htm
set A=server.createobject("scripting.filesystemobject")
path="G:\count\0"
i=0
response.write "主目录:<br>"&path&"<ul>"
re
response.write "</li></ul>" '-----------------主目录
sub re()
B=B&i
C=C&i
D=D&i
E=E&i
set B=A.getfolder(path) '----------------------主目录下文件
if i>=2 then response.write "<ul>"
for each E in B.files
response.write "<li>"&E.name&"</li>"
next
if i>=2 then response.write "</ul>"
'----------------------End '---------------------------主目录下文件夹 set C=B.SubFolders
if i>=2 then response.write "<ul>"
for each D in C
response.write "<li><b>"&D.name&"</b><font color=#c0c0c0>(DIR)</font>"
i=i+1
path=D
re2 '显示子目录
next
if i>=2 then response.write "</ul>"
'---------------------------End
end sub '-----------------次目录
sub re2()
B=B&i
C=C&i
D=D&i
set B=A.getfolder(path) '-----------------------------次目录下文件
response.write "<ul>"
for each E in B.files
response.write "<li>"&E.name&"</li>"
next
response.write "</ul>"
'-----------------------------End '-----------------------------次目录下文件夹
set C=B.SubFolders
response.write "<ul>"
for each D in C
response.write "<li><b>"&D.name&"</b><font color=#c0c0c0>(DIR)</font></li>"
i=i+1
path=D
re '显示子目录
next
response.write "</ul>" '-----------------------------End
end sub
%>
'引用自http://www.jscode.cn/arthtml/art4663.htm
评论: 0 | 引用: 0 | 查看次数: 1684
发表评论
你没有权限发表留言!