LOOPCOUNT 3 :LogonLoop FTPLOGON "my_ftp_site.com" /timeout=60 IFERROR= $ERROR_SUCCESS GOTO Operation1 ;; Try again for up to 3 attempts LOOPTO LogonLoop STOP :Operation1 SET temp = %datetime DATETIMESUB temp 10 /minute SET ten_min_ago = temp FTPGETFILE "*.txt" IFERROR= $ERROR_NO_FILE_FOUND GOTO Disconnect IFDATETIME> %sitefiledatetime ten_min_ago GOTO Operation2 GOTO Operation1 :Operation2 ;; File has been modified within last 10 minutes, so download it RCVFILE %sitefile GOTO Operation1 :Disconnect FTPLOGOFF EXIT