ChangeFTPDirectory Method
Class: FTP_SERVICE
Tries to change the current directory on the FTP Server to the path specified.
=
Object.ChangeFTPDirectory
Parameter
lcNewDir
New remote directory
Type Character
Direction Input
Name of the Path to change the current directory to.
Return value Boolean
Returns .T. if the function successfully changed the current directory on the FTP Server. Returns .F. if the function could not change the directory.
Example
LOCAL loFTP,lcPom
#INCLUDE "ftp.h"
SET PROCEDURE TO ftp.prg ADDITIVE 
loFTP=CREATEOBJECT('ftp_service') 

IF loFTP.OpenInternet("ABONNE", "PWD", "10.10.10.10", "21")
   IF !loFTP.ChangeFTPDirectory("dowload")
      ?loFTP.GetExtendedErrorCode(),loFTP.GetExtendedErrorMsg()
   ENDIF
   =loFTP.CloseInternet() 
ENDIF
RELEASE PROCEDURE ftp.prg
See also
Expand/Collapse source code of procedure ChangeFTPDirectory Source Code
LPARAMETERS INP lcNewDir
      LOCAL fResult, lcTempDir, llResult

      IF This.OpenFTPConnection(This.cStartupFolder)     && Open an FTP Handle                  
         llResult = .F.     

         lcNewDir = lcNewDir + cNULL  
         lcTempDir = SPACE(MAX_PATH)                            

         =This.BeforeChangeFTPDirectory(@lcNewDir)
         fResult = FtpSetCurrentDirectory(This.nConnect_Handle, @lcNewDir)
         =This.GetExtendedError()

         IF fResult = 1
            fResult = FtpGetCurrentDirectory(This.nConnect_Handle, @lcTempDir, MAX_PATH)
            =This.GetExtendedError()

            IF fResult = 1
               This.cCurrentDir = lcTempDir
               llResult = .T.
            ENDIF
         ENDIF
         =This.AfterChangeFTPDirectory(@lcNewDir,fResult)

         =IIF(This.lMultiOperations,.T.,This.CloseFTPConnection())   && Close FTP Handle
         RETURN llResult
      ENDIF           
      RETURN .F.