(Ruby) Transition from SFtp.ReadDir to SFtp.ReadDirListing
Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing. Note: This example requires Chilkat v11.0.0 or greater.
require 'chilkat'
success = false
sftp = Chilkat::CkSFtp.new()
# ...
# ...
handle = sftp.openDir(".")
# ...
# ...
# ------------------------------------------------------------------------
# The ReadDir method is deprecated:
# dirObj is a CkSFtpDir
dirObj = sftp.ReadDir(handle)
if (sftp.get_LastMethodSuccess() == false)
print sftp.lastErrorText() + "\n";
exit
end
# ...
# ...
# ------------------------------------------------------------------------
# Do the equivalent using ReadDirListing.
# Your application creates a new, empty SFtpDir object which is passed
# in the last argument and filled upon success.
dirOut = Chilkat::CkSFtpDir.new()
success = sftp.ReadDirListing(handle,dirOut)
if (success == false)
print sftp.lastErrorText() + "\n";
exit
end
# ...
# ...
sftp.CloseHandle(handle)
|