如何利用VBscript的文件对象列举指定目录下的所有文件?

呵呵,能够实现吗?怎么弄?
folder对象似乎没有相关的属性....
---------------------------------------------------------------

遍历目录下的所有文件和属性

 1<table border="">
 2<tr>
 3<td>Name 属性</td>
 4<td>DateCreated 属性</td>
 5<td>DateLastAccessed 属性</td>
 6<td>DateLastModified 属性</td>
 7<td>Drive 属性</td>
 8<td>Attributes 属性</td>
 9<td>ParentFolder 属性</td>
10<td>Path 属性</td>
11<td>ShortName 属性</td>
12<td>ShortPath 属性</td>
13<td>Size 属性</td>
14<td>Type 属性</td>
15</tr>   

Function ShowFolderList(folderspec)
Dim fso, f, f1, fc, s,tmp
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
tmp = " "
Select Case f1.Attributes
Case 0
tmp = "Normal:普通文件"
Case 1
tmp = "ReadOnly:只读文件"
Case 2
tmp = "Hidden:隐藏文件"
Case 4
tmp = "System:系统文件"
Case 16
tmp = "Directory:文件夹或目录"
Case 32
tmp = "Archive:上次备份后已更改的文件"
Case 1024
tmp = "Alias:链接或快捷方式"
Case 2048
tmp = "Compressed:压缩文件"
End Select
s = s &amp; "<tr>"
s = s &amp; "<td>" &amp; f1.Name &amp; "</td>"
s = s &amp; "<td>" &amp; f1.DateCreated &amp; "</td>"
s = s &amp; "<td>" &amp; f1.DateLastAccessed &amp; "</td>"
s = s &amp; "<td>" &amp; f1.DateLastModified &amp; "</td>"
s = s &amp; "<td>" &amp; f1.Drive &amp; "</td>"
s = s &amp; "<td>" &amp; tmp &amp; "</td>"
s = s &amp; "<td>" &amp; f1.ParentFolder &amp; "</td>"
s = s &amp; "<td>" &amp; f1.Path &amp; "</td>"
s = s &amp; "<td>" &amp; f1.ShortName &amp;"</td>"
s = s &amp; "<td>" &amp; f1.ShortPath &amp; "</td>"
s = s &amp; "<td>" &amp; f1.Size &amp; "</td>"
s = s &amp; "<td>" &amp; f1.Type &amp; "<td>"
s = s &amp; "</td></td></tr>"
Next
ShowFolderList = s
End Function
Response.write ShowFolderList(Server.MapPath("."))

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