找了一个晚上总算找到一个简单又好用的了
1
<html><body style="font-size: 13px">
2
读取一个文件夹或子文件夹内的所有文件范例<br><br>
3
<%
4
Dim objFSO,objFolder,objFile,FF '声明 objFSO 变量存放对象实例
5
FF = Server.MapPath("./images")
6
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
7
If objFSO.FolderExists(ff) Then
8
Response.write "文件夹 "&ff&" 里所有的文件:<br>"
9
Set objFolder = objFSO.GetFolder(ff)
10
For Each objFile in objFolder.Files
11
Response.Write objFile.Name & "<br>"
12
Next
13
Else
14
Response.Write "文件夹"&ff&"不存在,无法读取相关信息!"
15
End If
16
Set objFolder = Nothing
17
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
18
%>
19
</body></html>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19