ASP的服务器端操作?

我要用ASP做一个网站的管理系统,需要获取服务器某目录下所有文件的信息,如文件名、大小等,ASP有没有办法解决?
---------------------------------------------------------------

dim fso, f, fc
dim fp ' 文件路径
fp = request("fp")
if trim(fp) = "" then fp = "C:"
set fso = server.createobject("scripting.filesystemobject")
set f = fso.getFolder(fp)
set fc = f.subFolders
response.write "

1<b>类型   名称   大小</b>
1<br/>

"
for each ff in fc
response.write "文件夹   "
response.write "

1<a ""="" f.asp?fp=" &amp; ff.path &amp; " href="">" &amp; ff.name &amp; "</a>

"
.write ff.size & "

1<br/>

"
next
set fc = f.files
for each ff in fc
response.write "文件     "
response.write ff.name & "    "
response.write ff.size & "

1<br/>

"
next
---------------------------------------------------------------

1<table border="">
2<tr>
3<td>   
4Attributes 属性</td><td> DateCreated 属性</td><td> DateLastAccessed 属性</td><td> DateLastModified 属性</td><td> Drive 属性</td><td> Name 属性</td><td> ParentFolder 属性</td><td> Path 属性</td><td> ShortName 属性</td><td> ShortPath 属性</td><td> Size 属性</td><td> Type 属性<td>
5<tr>   
6  

Function ShowFolderList(folderspec)
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc

s = s &amp; "<tr><td>" &amp; f1.Attributes &amp; "</td><td>" &amp; f1.DateCreated &amp; "</td><td>" &amp; f1.DateLastAccessed &amp; "</td><td>" &amp; f1.DateLastModified &amp; "</td><td>" &amp; f1.Drive &amp; "</td><td>" &amp; f1.Name &amp; "</td><td>" &amp; f1.ParentFolder &amp; "</td><td>" &amp; f1.Path &amp; "</td><td>" &amp; f1.ShortName &amp;"</td><td>" &amp; f1.ShortPath &amp; "</td><td>" &amp; f1.Size &amp; "</td><td>" &amp; f1.Type &amp; "<td></td></td></tr>"

Next
ShowFolderList = s
End Function
Response.write ShowFolderList("D:\asptest")

1</tr></td></td></tr></table>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus