Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

ASP Files Collection

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The ASP Files Collection is used to return the collection of all the files present in a specified folder. These can be looped through to get the details of the individual files.

Syntax:

FolderObject.Files

Example: The below code demonstrates the ASP File.Files Collection.

ASP




<%
dim fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Get the folder to be read
set fo=fs.GetFolder("d:\geeks\")
  
'Loop through the files present in the folder
for each x in fo.files
  'Print the name of the file
  Response.write("Filename: " & x.Name & "<br>")
next
  
set fo=nothing
set fs=nothing
%>

Output:

Filename: GFG_adv.txt
Filename: sudo.txt
Filename: ram.txt
Filename: shyam.txt
My Personal Notes arrow_drop_up
Last Updated : 19 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials