Visual FoxPro
Visual FoxPro
Move File to Another Directory on Server
See more FTP Examples
Moves a file from one directory to another. This is accomplished by renaming the file using a filepath that includes the directory.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loFtp
LOCAL lcExistingFilepath
LOCAL lcNewFilepath
lnSuccess = 0
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loFtp = CreateObject('Chilkat.Ftp2')
loFtp.Hostname = "ftp.example.com"
loFtp.Username = "login"
loFtp.Password = "password"
* Connect and login to the FTP server.
lnSuccess = loFtp.Connect()
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
RELEASE loFtp
CANCEL
ENDIF
* Rename the remote file (or directory)
lcExistingFilepath = "dirA/hello.txt"
lcNewFilepath = "dirB/hello.txt"
lnSuccess = loFtp.RenameRemoteFile(lcExistingFilepath,lcNewFilepath)
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
RELEASE loFtp
CANCEL
ENDIF
lnSuccess = loFtp.Disconnect()
RELEASE loFtp