Jump to content

Search the Community

Showing results for tags '_FTP_FileGet'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 3 results

  1. Hey guys, I got a problem and rly need help. I try using FTP to get a file. Then the content of the file on the FTP-Server is getting changed, and I'm downloading this file again. This works, but the content of the file after downloading it the second time is the same like before...doesn't matter if I open and close the ftp session, or using the same. If I'm using manually FileZilla to get the File it works without any probs. #include <FTPEx.au3>; This line includes all the FTP functions you need. Open this file to see which functions contains exactly. $server = '' $username = '' $pass = '' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) $Ftpp = _FTP_FileGet($Conn, '/EDI-Archiv-CD/bin/Status.txt', 'C:\Users\mwenzel\Documents\proUSBPacker\Customers\Status.txt', False, 128, $FTP_TRANSFER_TYPE_ASCII) ;$FTP_TRANSFER_TYPE_BINARY If @error Then ConsoleWrite("ERROR - " & @error & " - " & @extended & " - " & _WinAPI_GetLastErrorMessage() & @CR) $Ftpc = _FTP_Close($Open) MsgBox(0, "", "") $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) ;~ _FTP_FileGet($l_FTPSession, $s_RemoteFile, $s_LocalFile [, $fFailIfExists = False, [$dwFlagsAndAttributes = 0 [, $l_Flags = 0 [, $l_Context = 0]]]]) $Ftpp = _FTP_FileGet($Conn, '/EDI-Archiv-CD/bin/Status.txt', 'C:\Users\mwenzel\Documents\proUSBPacker\Customers\Status.txt', False, 128, $FTP_TRANSFER_TYPE_ASCII) ;$FTP_TRANSFER_TYPE_BINARY If @error Then ConsoleWrite( Please help me out guys. I need to get this finished :/
  2. If somebody could please explain to me why is function "_FTP_FindFileFirst" returning over and over again the same files that I have allready downloaded and deleted, and why does the function "_FTP_FileGet" reports "Succeeded" on downloading non-existing file? Only the function "_FTP_FileDelete" works OK (it reports Failed on all passes except the first). $iStatus = 0 $sServer = 'ftp.test.com' $sUsername = 'userftp' $sPass = 'passftp' $iInterval = 10 ConsoleWrite ('Opening a new FTP session ... ') $hOpen = _FTP_Open ('FTP Control ' & @AutoItPID) If @error Then ConsoleWrite ('Failed' & @CRLF) Sleep (5000) Exit EndIf ConsoleWrite ('Succeeded' & @CRLF) Dim $FTPTime = 1000*$iInterval, $FTPStart = TimerInit (), $FTPEnd = TimerDiff ($FTPStart) While 'FTP Connection' $FTPEnd = TimerDiff ($FTPStart) Select Case $FTPEnd > $FTPTime If NOT $iStatus Then ConsoleWrite ('Connecting to FTP server: ftp://' & $sUsername & ':' & $sPass & '@' & $sServer & ' ... ') $hConnect = _FTP_Connect ($hOpen, $sServer, $sUsername, $sPass, 1) If @error Then ConsoleWrite ('Failed' & @CRLF) $FTPStart = TimerInit () ContinueLoop EndIf ConsoleWrite ('Succeeded' & @CRLF) ConsoleWrite ('--------------------------------------------------' & @CRLF & @CRLF) EndIf $iStatus = _FTP_Command ($hConnect, 'STAT') If NOT $iStatus Then ConsoleWrite ('Connection to FTP server was lost' & @CRLF) $FTPStart = TimerInit () ContinueLoop EndIf Dim $h_Handle $aFile = _FTP_FindFileFirst ($hConnect, '/Dir1/Dir2/Dir3/', $h_Handle) If NOT @error Then While 'FTP Download/Delete' Sleep (10) ConsoleWrite ('File found: ' & $aFile[10] & @CRLF) ConsoleWrite ('Downloading file ... ') _FTP_FileGet ($hConnect, '/Dir1/Dir2/Dir3/' & $aFile[10], 'D:\TargetDir\' & $aFile[10], False) If @error Then ConsoleWrite ('Failed' & @CRLF) Else ConsoleWrite ('Succeeded' & @CRLF) ConsoleWrite ('Deleting file ... ') _FTP_FileDelete ($hConnect, '/Dir1/Dir2/Dir3/' & $aFile[10]) If @error Then ConsoleWrite ('Failed' & @CRLF) Else ConsoleWrite ('Succeeded' & @CRLF) EndIf EndIf ConsoleWrite ('--------------------------------------------------' & @CRLF) $aFile = _FTP_FindFileNext ($h_Handle) If @error Then ExitLoop WEnd EndIf $aClose = _FTP_FindFileClose ($h_Handle) ConsoleWrite ('No new files' & @CRLF) $FTPStart = TimerInit () EndSelect WEnd $hDisconnect = _FTP_Close ($hConnect) $hClose = _FTP_Close ($hOpen) Exit
  3. I have code that uses calls to functions in FTPEx.au3 to copy a file to a local directory, but the copy fails. The steps I took were: _FTP_Open() _FTP_Connect() _FTP_FileGet() The _FTP_FileGet() returns a 0 (failed) and the file is not copied. I've tried passing the full FTP pathname and just the base filename, and I've tried inserting a call to _FTP_DirSetCurrent() just before calling _FTP_FileGet(), but nothing worked. Here is my test code: #include <FTPex.au3> _Main() Func _Main() $ret = copyFile() $err = @error ConsoleWrite("..." & @CRLF) ConsoleWrite("+++: $err = " & $err & ", $ret = " & $ret & @CRLF) EndFunc ;==>_Main Func copyFile() Local $sIP, $sUsername, $sPassword, $FTPDir, $localDir, $fname, $session Local $err, $hConn, $from, $to, $ret $sIP = "xxxxxx" $sUsername = "xxxxx" $sPassword = "xxxxx" $FTPDir = "/Andy" $localDir = "C:\Temp" $fname = "READ2ME.txt" $from = $FTPDir & "/" & $fname $to = $localDir & "\" & $fname $session = open() If ($session == 0) Then Return (0) $hConn = connect($session, $sIP, $sUsername, $sPassword) If ($hConn == 0) Then Return (0) ;$ret = setcurrent($hConn, $FTPDir) ; <-- returns '1' (not a dir name, like the help doc says) ;If ($ret == 0) Then Return (0) $ret = fileget($hConn, $from, $to) If ($ret == 0) Then Return (0) If (FileExists($to)) Then ConsoleWrite("--> File copied OK" & @CRLF) Return (0) Else ConsoleWrite("--> File wasn't copied!!") Return (1) EndIf EndFunc ;==>copyFile Func open() $session = _FTP_Open('_myFTP Control') $err = @error ConsoleWrite("+++: after _FTP_Open(): @error = " & $err & ", $session = " & Hex($session) & @CRLF) If ($err <> 0) Or ($session == 0) Then ConsoleWrite("+++: _FTP_Open() - FAILED" & @CRLF) Return (0) Else ConsoleWrite("+++: _FTP_Open() - OK" & @CRLF) Return ($session) EndIf EndFunc ;==>open Func connect($session, $ip, $uname, $pwd) $hConn = _FTP_Connect($session, $ip, $uname, $pwd) $err = @error ConsoleWrite("+++: after _FTP_Connect(): @error = " & $err & ", $hConn = " & Hex($hConn) & @CRLF) If ($err <> 0) Or ($hConn == 0) Then ConsoleWrite("+++: _FTP_Connect() - FAILED" & @CRLF) Return (0) Else ConsoleWrite("+++: _FTP_Connect() - OK" & @CRLF) Return ($hConn) EndIf EndFunc ;==>connect Func setcurrent($hConn, $fdir) $ret = _FTP_DirSetCurrent($hConn, $fdir) ; Note: returns '1' instead of the Dir name $err = @error ConsoleWrite("+++: after _FTP_DirSetCurrent(): @error = " & $err & ", $ret = " & $ret & @CRLF) If ($err <> 0) Or ($ret == 0) Or ($ret == "") Then ConsoleWrite("+++: _FTP_DirSetCurrent() - FAILED" & @CRLF) Return (0) Else ConsoleWrite("+++: _FTP_DirSetCurrent() - OK" & @CRLF) Return ($ret) EndIf EndFunc ;==>setcurrent Func fileget($hConn, $from, $to) $ret = _FTP_FileGet($hConn, $from, $to, False) $err = @error ConsoleWrite("+++: after _FTP_FileGet(): $ret = " & $ret & ", @error = " & $err & @CRLF) ConsoleWrite("+++: $from = " & $from & ", $to = " & $to & @CRLF) If ($err <> 0) Or ($ret <> 1) Then ConsoleWrite("+++: _FTP_FileGet() - FAILED " & @CRLF) Return (0) Else ConsoleWrite("+++: _FTP_FileGet() - OK" & @CRLF) EndIf EndFunc ;==>fileget Here is the Console output: +++: after _FTP_Open(): @error = 0, $session = 00CC0004 +++: _FTP_Open() - OK +++: after _FTP_Connect(): @error = 0, $hConn = 00CC0008 +++: _FTP_Connect() - OK +++: after _FTP_FileGet(): $ret = 0, @error = -1 +++: $from = /Andy/READ2ME.txt, $to = C:\Temp\READ2ME.txt +++: _FTP_FileGet() - FAILED ... +++: $err = 0, $ret = 0 Any help would be appreciated. Andy
×
×
  • Create New...