I'm out of my mind? I cannot find a way to get the first file in a folder with FileSystemObject (classic ASP). In most collections, you might think that an index of 0 or 1 might work, but IIS says "Invalid call or procedure argument."
None of these last two lines work:
Set oFileScripting = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFileScripting.GetFolder(sFolder)
Set oFiles = oFolder.Files
If oFiles.Count = 0 Then Response.Write "no files"
Response.Write oFiles(0).Name
Response.Write oFiles.Item(1).Name
Am I really very stupid, or is there no way to use the index to access this particular collection?
source
share