Sample code for 30+ languages & platforms
VBScript

Transition from SFtp.ReadDir to SFtp.ReadDirListing

Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set sftp = CreateObject("Chilkat.SFtp")

' ...
' ...

handle = sftp.OpenDir(".")
' ...
' ...

' ------------------------------------------------------------------------
' The ReadDir method is deprecated:

' dirObj is a Chilkat.SFtpDir
Set dirObj = sftp.ReadDir(handle)
If (sftp.LastMethodSuccess = 0) Then
    outFile.WriteLine(sftp.LastErrorText)
    WScript.Quit
End If

' ...
' ...

' ------------------------------------------------------------------------
' Do the equivalent using ReadDirListing.
' Your application creates a new, empty SFtpDir object which is passed 
' in the last argument and filled upon success.

set dirOut = CreateObject("Chilkat.SFtpDir")
success = sftp.ReadDirListing(handle,dirOut)
If (success = 0) Then
    outFile.WriteLine(sftp.LastErrorText)
    WScript.Quit
End If

' ...
' ...

success = sftp.CloseHandle(handle)

outFile.Close