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.


encrypt_multiple_files.s

Download

The PGPENCRYPT command does not support using wildcards. However, it is still possible to get the effect of using wildcards by combining the PGPENCRYPT command with other Robo-FTP script commands that do support wildcards, such as GETFILE and GETNEXTFILE.

This sample script uses GETFILE to iterate over the files in a directory, encrypting and moving each file one at a time.


  1  set source_dir = "C:\data\source_files"
  2  set archive_dir = "C:\data\archive"
  3  set destination_dir = "C:\data\encrypted_files"
  4  
  5  WORKINGDIR source_dir
  6  :loop
  7  GETNEXTFILE "*"
  8  IFERROR RETURN $ERROR_SUCCESS
  9  set destination_file = %nextfile + ".pgp"
 10  PGPENCRYPT %nextfile destination_file /encryptfor="Richard Tracy"
 11  MOVE %nextfile archive_dir
 12  MOVE destination_file destination_dir
 13  GOTO loop

Browse complete list of scripts