Search the Community
Showing results for tags '_FTP_FindFileFirst'.
-
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 replies
-
- FTPEx
- _FTP_FindFileFirst
-
(and 1 more)
Tagged with: