Question

I don't know how much the system stores in memory at this line For Each objFile in objFolder.Files and whether iterating using something like objFile.Files.Count would be more beneficial. Does anyone knows if using the following code would create any significant performance issues?

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Get the folder object associated with the directory
Dim objFolder
Set objFolder = objFSO.GetFolder("C:\InetPub\wwwroot")

Response.Write "The files found in " & objFolder.Name & ":<br>"

'Loop through the Files collection
Dim objFile
For Each objFile in objFolder.Files
  Response.Write objFile.Name & "<br>"
Next

'Clean up!
Set objFolder = Nothing
Set objFile = Nothing
Set objFSO = Nothing
Was it helpful?

Solution

I don't know how much the system stores in memory at this line For Each objFile in objFolder.Files

Not sure what you mean but this will just loop over a collection of File objects which will not use a lot of memory. This call will clearly not load the content of the files in memory if that is your question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top