response.write "<td>文件大小</td>"
response.write "<td>更新日期</td></tr>"
for each objfoldercount in objfolder.subfolders ’循环显示文件夹
response.write "<tr><td><a href=?path="&objfoldercount.name&">"&objfoldercount.name&"</td>" ’文件夹名称
response.write "<td>"&objfoldercount.type&"</td>" ’文件夹属性
response.write "<td> </td>" ’文件夹大小
response.write "<td>"&objfoldercount.DateCreated&"</td>" ’时间
next
for each objfileitem in objfoldercontents ’循环
response.write "<tr><td><a href="&objfileitem.name&">"&objfileitem.name&"</a></td>" ’文件名
response.write "<td>"&objfileitem.type&"</td>" ’类型
response.write "<td>"&objfileitem.size&"k</td>" ’文件大小
response.write "<td>"&objfileitem.datelastmodified&"</td></tr>" ’更新日期
next
response.write "</table>"
%>
以下是引用片段:
<%
Dim objFSO,objFolder,objFile,FF ’声明 objFSO 变量存放对象实例
FF = Server.MapPath("/")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(ff) Then
Response.write "文件夹 "&ff&" 里所有的文件:<br>"
Set objFolder = objFSO.GetFolder(ff)
For Each objFile in objFolder.Files
Response.Write objFile.Name & "<br>"
Next
Else
Response.Write "文件夹"&ff&"不存在,无法读取相关信息!"
End If
Set objFolder = Nothing
Set objFSO = Nothing ’释放 FileSystemObject 对象实例内存空间
%>
</body></html>
Folder对象
method
FSO.GetAbsolutePathName 接受参数folderpath,返回folderpath文件夹的绝对路径
FSO.BuildPath接受字符串参数path,name.在现有路径path上增加name文件(夹)
property
Folder.Files 返回文件夹下所有文件的F