function abb(path)
dim FSO
dim id:id=1
set FSO=server.createobject("scripting.FileSystemObject")
on error resume next
set objFolders=FSO.getFolder(path)' 建立文件夹对象
set objSubFolders=objFolders.subFolders
response.write "<font color=red>路径:"&path&"文件</font><br>"
for each objFile in objFolders.files
response.write "<font color=red>"&id&"</font><br>"
response.write "文件名:"&objFile.name&"<br>"
response.write "文件大小:"&cstr(objFile.size/1024)&"字节<br>"
id=id+1
next
response.write "<font color=red>路径:"&path&"目录:</font><br>"
for each objSubFolder in objSubFolders
response.write "文件夹:"&objSubFolder.name&"<br>"
next
end function
call abb("d:\")
比较简单的一个遍历!以供参考!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<%
spath=request.QueryString("id")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<%
function abb(path)
dim FSO
dim id:id=1
dim str
set FSO=server.createobject("scripting.FileSystemObject")
on error resume next
set objFolders=FSO.getFolder(path)' 建立文件夹对象
set objSubFolders=objFolders.subFolders
response.write "<font color=red>路径:"&path&"文件</font><br>"
for each objFile in objFolders.files
response.write "<font color=red>"&id&"</font><br>"
response.write "文件名:"&objFile.name&"<br>"
response.write "文件大小:"&cstr(objFile.size/1024)&"字节<br>"
id=id+1
next
response.write "<font color=red>路径:"&path&"目录:</font><br>"
for each objSubFolder in objSubFolders str="<a href=Untitled-1.asp?id="&path&"\"&objSubFolder.name&">"&objSubFolder.name&"</a>"
response.write "文件夹:"&str&"<br>" next
end function
if spath="" then
call abb("d:")
else
call abb(spath)
end if
%> <body>
</body>
</html>