(AutoIt) Move File to Another Directory on Server
Moves a file from one directory to another. This is accomplished by renaming the file using a filepath that includes the directory.
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oFtp = ObjCreate("Chilkat.Ftp2")
$oFtp.Hostname = "ftp.example.com"
$oFtp.Username = "login"
$oFtp.Password = "password"
; Connect and login to the FTP server.
Local $bSuccess = $oFtp.Connect()
If ($bSuccess <> True) Then
ConsoleWrite($oFtp.LastErrorText & @CRLF)
Exit
EndIf
; Rename the remote file (or directory)
Local $sExistingFilepath = "dirA/hello.txt"
Local $sNewFilepath = "dirB/hello.txt"
$bSuccess = $oFtp.RenameRemoteFile($sExistingFilepath,$sNewFilepath)
If ($bSuccess <> True) Then
ConsoleWrite($oFtp.LastErrorText & @CRLF)
Exit
EndIf
$bSuccess = $oFtp.Disconnect()
|