找了一个晚上总算找到一个简单又好用的了
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
>
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
11
![None.gif](/Images/OutliningIndicators/None.gif)
12
![None.gif](/Images/OutliningIndicators/None.gif)
13
![None.gif](/Images/OutliningIndicators/None.gif)
14
![None.gif](/Images/OutliningIndicators/None.gif)
15
![None.gif](/Images/OutliningIndicators/None.gif)
16
![None.gif](/Images/OutliningIndicators/None.gif)
17
![None.gif](/Images/OutliningIndicators/None.gif)
18
![None.gif](/Images/OutliningIndicators/None.gif)
19
![None.gif](/Images/OutliningIndicators/None.gif)