Sample code for 30+ languages & platforms
DataFlex

Transition from SFtp.ReadDir to SFtp.ReadDirListing

Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoSftp
    String sHandle
    Variant vDirObj
    Handle hoDirObj
    Variant vDirOut
    Handle hoDirOut
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatSFtp)) To hoSftp
    If (Not(IsComObjectCreated(hoSftp))) Begin
        Send CreateComObject of hoSftp
    End

    // ...
    // ...

    Get ComOpenDir Of hoSftp "." To sHandle
    // ...
    // ...

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

    Get ComReadDir Of hoSftp sHandle To vDirObj
    If (IsComObject(vDirObj)) Begin
        Get Create (RefClass(cComChilkatSFtpDir)) To hoDirObj
        Set pvComObject Of hoDirObj To vDirObj
    End
    Get ComLastMethodSuccess Of hoSftp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoSftp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ...
    // ...

    Send Destroy of hoDirObj

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

    Get Create (RefClass(cComChilkatSFtpDir)) To hoDirOut
    If (Not(IsComObjectCreated(hoDirOut))) Begin
        Send CreateComObject of hoDirOut
    End
    Get pvComObject of hoDirOut to vDirOut
    Get ComReadDirListing Of hoSftp sHandle vDirOut To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoSftp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ...
    // ...

    Get ComCloseHandle Of hoSftp sHandle To iSuccess


End_Procedure