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.
This script downloads all files from a remote folder and moves them to a remote archive folder only if the download was successful.
The following command line syntax may be used to launch Robo-FTP and automatically execute this script:
You can also add the
-v option to the command line to hide the Robo-FTP window.
1 ;; Set directory path for downloaded files 2 WORKINGDIR "c:\download\destination\folder" 3 4 ;; Set path of existing remote archive directory 5 SET site_archive_folder = "/old" 6 7 ;; Connect to site 8 FTPLOGON "ftp.mydomain.com" /user="UserID" /pw="secret" 9 10 ;; Download files and then move them into the 11 ;; archive folder only if download is successful 12 :loop 13 GETSITEFILE "*" 14 RCVFILE %sitefile 15 IFERROR GOTO done 16 SET new_name = site_archive_folder + "/" + %sitefile 17 FTPRENAME %sitefile new_name 18 IFERROR GOTO done 19 GOTO loop 20 21 ;; Disconnect and terminate 22 :done 23 FTPLOGOFF 24 EXIT