Script Library

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.


download_and_archive.s

Download

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:

robo-ftp.exe -s"download_and_archive.s"

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 "My Remote Site"
  9  IFERROR RETURN
 10  
 11  ;; Download files and then move them into the 
 12  ;; archive folder only if download is successful
 13  :loop
 14  GETSITEFILE "*"
 15  IFERROR RETURN $ERROR_SUCCESS 
 16  RCVFILE %sitefile 
 17  IFERROR RETURN
 18  SET new_name = site_archive_folder + %sitefile
 19  FTPRENAME %sitefile new_name 
 20  IFERROR RETURN
 21  GOTO loop

Browse complete list of scripts