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_and_Upload.s
Encrypt a file with PGP, log onto an FTP site, upload the PGP encrypted file, and finally log off the server. This script also demonstrates some techniques for issuing error handling commands, including deleting the local files once they have been successfully uploaded.
1 ;;
2 ;; Encrypt file
3 ;;
4 PGPENCRYPT "datafile.txt" "datafile.txt.pgp" /user=username_for_recipients_key
5 IFERROR= $ERROR_SUCCESS GOTO Operation1
6 GOTO Done
7 ;;
8 ;; Logon to FTP site
9 ;;
10 :Operation1
11 FTPLOGON "IP Address" /user=username /pw=password
12 IFERROR= $ERROR_SUCCESS GOTO Operation2
13 GOTO Disconnect
14 ;;
15 ;; Upload encrypted file to FTP site
16 ;;
17 :Operation2
18 SENDFILE "datafile.txt.pgp"
19 IFERROR= $ERROR_SUCCESS GOTO Operation3
20 GOTO Disconnect
21 ;;
22 ;; Clean up files
23 ;;
24 :Operation3
25 DELETE "datafile.txt"
26 DELETE "datafile.txt.pgp"
27 ;;
28 ;; Logoff to FTP Site
29 ;;
30 :Disconnect
31 FTPLOGOFF
32 :Done
33 exit

