Jump to content

FTP fails


Recommended Posts

I am doing a script for FTP to different IP's using AutoIT

I may have multiple files and ofcource multiple IPS

I have done this script and it always fails to put file into the second IP. Where I am wrong?

Func TransferFile()
    GetGuiData()

    $Open = _FTP_Open('MyFTP')
    For $Idx = 0 To $ipCount - 1
        Local $server = $IPlist[$Idx]
        $Conn = _FTP_Connect($Open, $server, $UserName, $Password, 1)
        ConsoleWrite("Total Files - " & $FileCount & @CRLF)
        If Not @error Then
        ConsoleWrite("Current IP is - " & $server & @CRLF)
            For $Idy = 0 To $FileCount - 1
                ConsoleWrite("Current Source file is - " & $SourceFile[$Idy] & @CRLF)
                _FTP_FileDelete($Conn, $DestinationPath & $SourceFile[$Idy])
                $Ftpp = _FTP_FilePut($Conn, $SourcePath[$Idy], $DestinationPath & $SourceFile[$Idy])
                $percent = _FTP_ProgressUpload($Conn, $SourcePath[$Idy], $DestinationPath)
                ConsoleWrite('$Ftpp = ' & $Ftpp & @CRLF)
                If Not $Ftpp Then
                    ConsoleWrite("Failed to upload " & $SourcePath & " at \\" & $server & @CRLF)
                    MsgBox(0, "Error", "Failed to upload " & $SourcePath & " at \\" & $server)
                    $Ftpc = _FTP_Close($Open)
                    ConsoleWrite("_FTP_Close" & @CRLF)
                    ExitLoop
                EndIf
            Next
            $Ftpc = _FTP_Close($Open)
            if $Ftpc Then ConsoleWrite("Close current FTP @ - " & $IPlist[$Idx] & @CRLF)
        Else
            MsgBox(0, "Error", "Connection Error at \\" & $server)
            $Ftpc = _FTP_Close($Open)
            ContinueLoop
        EndIf
    Next
EndFunc   ;==>TransferFile
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...