Sample code for 30+ languages & platforms
Delphi DLL Requires Chilkat v11.0.0+

Transition from SFtp.ReadDir to SFtp.ReadDirListing

Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
sftp: HCkSFtp;
handle: PWideChar;
dirObj: HCkSFtpDir;
dirOut: HCkSFtpDir;

begin
success := False;

sftp := CkSFtp_Create();

//  ...
//  ...

handle := CkSFtp__openDir(sftp,'.');
//  ...
//  ...

//  ------------------------------------------------------------------------
//  The ReadDir method is deprecated:

dirObj := CkSFtp_ReadDir(sftp,handle);
if (CkSFtp_getLastMethodSuccess(sftp) = False) then
  begin
    Memo1.Lines.Add(CkSFtp__lastErrorText(sftp));
    Exit;
  end;

//  ...
//  ...

CkSFtpDir_Dispose(dirObj);

//  ------------------------------------------------------------------------
//  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 := CkSFtpDir_Create();
success := CkSFtp_ReadDirListing(sftp,handle,dirOut);
if (success = False) then
  begin
    Memo1.Lines.Add(CkSFtp__lastErrorText(sftp));
    Exit;
  end;

//  ...
//  ...

CkSFtp_CloseHandle(sftp,handle);

CkSFtp_Dispose(sftp);
CkSFtpDir_Dispose(dirOut);