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.


decrypt_and_rename.s

Download

When somebody PGP encrypts a file, the encrypted file is often given a different name than the original file, but the original filename is still stored along with the rest of the data in the encrypted file.

For example, you can start with a file called "my_data.txt" and PGP encrypt it, calling the resulting file, "encrypted_data.txt.pgp." So, as you can see, the encrypted file can be called anything you want.

The original filename will still be stored along with the rest of the data. So, when you PGP decrypt the file with the PGPDECRYPT command, the resulting decrypted file will have the original filename ("my_data.txt" in this case).

There may be cases where you do not want to use the original filename after decrypting a file.

This sample script shows how to specify the filename to use for the decrypted file. It looks for all the .pgp files in a directory and decrypts them, naming the decrypted file by removing the .pgp extension.


  1  WORKINGDIR "C:\encrypted_files"
  2  :loop
  3  GETREWIND
  4  GETFILE "*.pgp"
  5  IFERROR= $ERROR_NO_FILE_FOUND GOTO no_more_files
  6  SET filename = %nextfile
  7  SETRIGHT extension = filename 4 /split

  8  PGPDECRYPT %nextfile filename
  9  ; If decryption fails, exit
 10  IFERROR GOTO no_more_files
 11  DELETE %nextfile
 12  GOTO loop
 13  :no_more_files
 14  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