ASP Files Collection

Definition and Usage

The Files collection returns a collection of all files in the specified folder.

Syntax:

FolderObject.Files

Instance

<%
dim fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test\")
for each x in fo.files
  Print the name of all files in the test folder
  Response.write(x.Name & "<br />")
next
set fo=nothing
set fs=nothing
%>

Output similar to this:

file_01.txt
file_02.txt
file_03.txt
file_04.txt
file_05.txt
file_06.txt