I\'m trying to print documents in a directory, ordered by file name ascending. I have the script below to print out the documents, which works, but it\'s in a random order. Is
The are many ways to get an odered list of the file(name)s in a directory. One uses the .NET ArrayList - like this:
Option Explicit
Dim oFS : Set oFS = CreateObject("Scripting.FileSystemObject")
Dim sDir : sDir = "... your folder ..."
Dim oFiles : Set oFiles = CreateObject("System.Collections.ArrayList")
Dim oFile
For Each oFile In oFS.GetFolder(sDir).Files
WScript.Echo oFile.Name
oFiles.Add oFile.Path
Next
WScript.Echo "----------"
oFiles.Sort
Dim sFile
For Each sFile In oFiles
WScript.Echo oFS.GetFile(sFile).Name
Next
If you can't harness .Net, you could
dir /o:n