如何编写组件获取服务器上某路径下的目录和文件清单?

jerr 2000-03-13 01:02:00
请教各位大虾如何编写组件获取服务器上某路径下的目录和文件清单,类似于在DOS下的DIR /S > dirlist.txt 的效果,最好能提供例子,谢谢!
...全文
122 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zdg 2000-03-13
  • 打赏
  • 举报
回复
用filesystemobject...

<SCRIPT LANGUAGE=vbscript RUNAT = Server>
Dim fs, folderpara, folderArray
Set fs = CreateObject("Scripting.FileSystemObject")
folderArray = Array("root_folder1", "root_folder2")
for i = 0 to 1
folderpara = folderArray(i)
Response.write "<UL>"
Response.write "<LI STYLE='list-style-image: url(images/close.gif)'>" & folderpara & "</LI>"
Call ShowFolderList(folderpara)
Response.write "</UL>"
next
set fs = Nothing

Sub ShowFolderList(folderspec)
Dim f, f1, fc, s
Set f = fs.GetFolder(server.mappath(folderspec))
Set fc = f.SubFolders
if (not (fc.count = 0)) then
Response.write "<UL>"
For Each f1 in fc
s = f1.name
If (not ((left (s, 1)) = "_")) then
Response.write "<li onmousemove='mousemove()' onmouseout='mouseout()'>"
Response.write "<a href='display.asp?sPath=" & folderspec & "/" & s & "&" & "XDoc=on&XPpt=on&XZip=on" & "'>"
Response.write s & "</LI>"
Response.write "</a>"
Call ShowFolderList((folderspec & "/" & s))
end if
Next
Response.write "</UL>"
end if
end sub
</SCRIPT>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧