Call now to talk to an automation expert — (512) 345-2211

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.


delete_old_files.s

Download

Robo-FTP is often used to perform clean-up duties on remote or local folders. This sample script scans a local directory and deletes all files older than 30 days. This technique could be used for log rotation, for example.


  1  WORKINGDIR "c:\folder\to\clean"
  2  SET temp = %datetime
  3  DATETIMESUB temp 30 /day

  4  SET thirty_days_ago = temp
  5  :loop
  6  GETNEXTFILE "*" /oldest

  7  IFERROR= $ERROR_NO_FILE_FOUND GOTO done
  8  IFDATETIME> %nextfiledatetime thirty_days_ago GOTO done
  9  ;; File is more than 30 days old, so delete it
 10  DELETE %nextfile
 11  ;; It's a good idea to make sure the delete doesn't fail due
 12  ;; to a permissions issue (want to avoid getting stuck in
 13  ;; an infinite loop).
 14  iferror goto done
 15  GOTO loop
 16  :done
 17  EXIT

Browse complete list of scripts

Need help figuring out where to start?

Our sales staff is available to answer product questions and help you determine if Robo-FTP is a good match for your project.

Call Now: (512) 345-2211