Order of Files collection in FileSystemObject

Is it really too much code to sort?

set fso = CreateObject("Scripting.FileSystemObject")

Set outputLines = CreateObject("System.Collections.ArrayList")
for each f in fso.GetFolder(".").files
  outputLines.Add f.Name
next
outputLines.Sort() ' 5 lines...

For Each outputLine in outputLines
  set file = fso.GetFolder(".").files.item (outputLine&"")
  Wscript.Echo file.name ' TODO: your thing here
Next

Leave a Comment