我不知道系统在这一行的内存中存储了多少,For Each objFile in objFolder.Files
以及使用类似的东西进行迭代是否objFile.Files.Count
会更有益。有谁知道使用以下代码是否会产生任何重大的性能问题?
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