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_recently_modified.s

Download

This script logs onto an FTP server and downloads all files that have been modified in the last 10 minutes.

Note: It is even easier to make a script to download only files modified today.


  1  FTPLOGON "my_ftp_site.com" /timeout=60 
  2  IFERROR RETURN
  3  SET ten_min_ago = %datetime
  4  DATETIMESUB ten_min_ago 10 /minute 
  5  :loop
  6  FTPGETFILE "*.txt" /newest 
  7  IFERROR RETURN $ERROR_SUCCESS  
  8  IFDATETIME< %sitefiledatetime ten_min_ago RETURN  $ERROR_SUCCESS
  9  ;; File has been modified within last 10 minutes, so download it
 10  RCVFILE %sitefile 
 11  IFERROR RETURN 
 12  GOTO loop 

Browse complete list of scripts