Jump to content
Sign in to follow this  
BlackEvil

FTP fails

Recommended Posts

BlackEvil

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

Share this post


Link to post
Share on other sites
BlackEvil

reading the IP list right ?

yes :mellow:

pops up the message for seccond ip here

MsgBox(0, "Error", "Failed to upload " & $SourcePath & " at \\" & $server)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.