ASP (FSO)如何读取文件夹下的子文件 只要读文件夹就行!!

zyfflash 2008-09-17 03:56:20
RT
...全文
75 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
sy_binbin 2008-09-17
  • 打赏
  • 举报
回复
<%
Dim sPath, oFso, oFout, File
sPath = "bin"
Set oFso = Server.CreateObject("Scripting.FileSystemObject")
Set oFout = oFso.GetFolder(Server.Mappath(sPath))
Response.Write "<table border='1' cellspacing='0' cellpadding='0' align='center'>" & _
"<tr align='center'>" & _
"<td>文件名称</td>" & _
"<td>文件短路径名</td>" & _
"<td>文件物理地址</td>" & _
"<td>文件属性</td>" & _
"<td>文件大小</td>" & _
"<td>文件类型</td>" & _
"<td>文件创建时间</td>" & _
"<td>最近访问时间</td>" & _
"<td>最近修改时间</td>" & _
"</tr>"
For Each File In oFout.Files
Response.Write "<tr>" & _
"<td>" & File.Name & "</td>" & _
"<td>" & File.ShortPath & "</td>" & _
"<td>" & File.Path & "</td>" & _
"<td>" & File.Attributes & "(" & SenFe_Attributes(File.Attributes) & ")</td>" & _
"<td>" & File.Size & "</td>" & _
"<td>" & File.Type & "</td>" & _
"<td>" & File.DateCreated & "</td>" & _
"<td>" & File.DateLastAccessed & "</td>" & _
"<td>" & File.DateLastModified & "</td>" & _
"</tr>"
Next
Response.Write "</table>"
Set oFout = Nothing
Set oFso = Nothing
Function SenFe_Attributes(iType)
Select Case iType
Case 0 SenFe_Attributes = "Normal-普通文件, 没有设置任何属性."
Case 1 SenFe_Attributes = "ReadOnly-只读文件,可读写."
Case 2 SenFe_Attributes = "Hidden-隐藏文件,可读写."
Case 4 SenFe_Attributes = "System-系统文件,可读写."
Case 16 SenFe_Attributes = "Directory-文件夹或目录,只读."
Case 32 SenFe_Attributes = "Archive-上次备份后已更改的文件,可读写."
Case 1024 SenFe_Attributes = "Alias-链接或快捷方式,只读."
Case 2048 SenFe_Attributes = "Compressed-压缩文件,只读."
End Select
End Function
%>

28,391

社区成员

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

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