Sample code for 30+ languages & platforms
AutoIt

Upload Directory Tree

See more FTP Examples

Upload an entire directory tree from the local filesystem to an FTP server.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oFtp = ObjCreate("Chilkat.Ftp2")

$oFtp.KeepSessionLog = True

$oFtp.Hostname = "ftp.example.com"
$oFtp.Username = "login"
$oFtp.Password = "password"

; Connect and login to the FTP server.
$bSuccess = $oFtp.Connect()
If ($bSuccess <> True) Then
    ConsoleWrite($oFtp.LastErrorText & @CRLF)
    Exit
EndIf

; Set the current remote directory to the root where the
; directory tree will be uploaded.
$bSuccess = $oFtp.ChangeRemoteDir("/something")
If ($bSuccess <> True) Then
    ConsoleWrite($oFtp.LastErrorText & @CRLF)
    Exit
EndIf

; Upload the entire directory tree rooted at c:/temp/something
$bSuccess = $oFtp.PutTree("c:/temp/something")
If ($bSuccess <> True) Then
    ConsoleWrite($oFtp.LastErrorText & @CRLF)
    Exit
EndIf

$bSuccess = $oFtp.Disconnect()

ConsoleWrite($oFtp.SessionLog & @CRLF)