Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.
resume_download
Robo-FTP supports resuming downloads with servers that also support this feature (most do these days).
This means that if you get half-way through a large download and your internet connection drops, you can resume the download at whatever point you lost your connection instead of starting over from the beginning.
This sample demonstrates how to use the resume feature along with some other related features like looping and sending email notifications.
The script logs on and tries to download a file. If the download fails, it re-tries three times.
It uses the /resumeany option which tells Robo-FTP to resume the broken download if a partial copy of the file exists locally and the server supports resuming the download. Otherwise, it tries to download the complete file.
If it still is unable to finish downloading the file after three tries, it sends a notification email.
1 * Set some variables that we will use later
2 SET from = "Robo-FTP Script Runner"
3 SET from_email = "myaddress@mycompany.com"
4 SET subj = "Automatic download failure"
5 SET body = "Today's download failed. Please contact support."
6 SET server = "smtp.mail.server"
7 SET to = "Ray Johnson"
8 SET to_email = "rjj@laugh-in.com"
9
10 FTPLOGON "mysite"
11 LOOPCOUNT 3
12 :many_tries
13 RCVFILE "mydownload.txt" /resumeany
14 LOOPIF goto many_tries else goto downloaded
15
16 * Failure
17 * If you get to this point, it means that the
18 * script has tried to download the file three
19 * times and still can't complete the download
20 CREATEMAIL from from_email subj body ""
21 SENDMAIL server to to_email /user=smtpid /pw=smtppw
22 goto done
23
24 :downloaded
25 * Success!
26 * Additional processing goes here
27 :done
28 ftplogoff
29 exit

