RenameFTPFile Method
Class: FTP_SERVICE
Description:Renames a file
Pretty simple, just renames a file.
=
Object.RenameFTPFile
Parameter
lcOldFile
Old file name
Type Character
Direction Input
Current file name on FTP Server.
lcNewFile
New file name
Type Character
Direction Input
New name for file on FTP Server.
Return value Boolean
Returns .T. if the function successfully renamed the file on the FTP Server. Returns .F. if the function could not rename the file.
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.RenameFTPFile("any.txt","any2.txt") ?loFTP.GetExtendedErrorCode(),loFTP.GetExtendedErrorMsg() ENDIF =loFTP.CloseInternet() ENDIF RELEASE PROCEDURE ftp.prg
See also
Expand/Collapse source code of procedure RenameFTPFile Source Code
      LPARAMETERS INP lcOldFile,INP lcNewFile
      LOCAL fResult
      IF This.OpenFTPConnection(This.cCurrentDir)     && Open an FTP Handle
         lcOldFile = m.lcOldFile + cNULL
         lcNewFile = m.lcNewFile + cNULL
                                
         =This.BeforeRenameFTPFile(@m.lcOldFile, @m.lcNewFile)
         fResult = FtpRenameFile(This.nConnect_Handle, @m.lcOldFile, @m.lcNewFile)
         =This.GetExtendedError()
         =This.AfterRenameFTPFile(@m.lcOldFile, @m.lcNewFile,m.fResult)
         =IIF(This.lMultiOperations,.T.,This.CloseFTPConnection())   && Close FTP Handle
         RETURN m.fResult = 1
      ENDIF
      RETURN .F.