I am playing with PGP keys for a project I am working on and the next phase requires a script to be written. This is what the script needs to do:
- Move the encrypted file into an archive.
- Decrypt the file and place it in a specific directory that will be used by the load process which an application team will be creating.
Once the load process is complete, the decrypted file will be deleted outside of the script.
I found this in my search:
mv /directory/*.gpg /home/service_account/directory
FOR /F "tokens=+" %%F IN ('DIR * .gpg /B') DO (
gpg --output "&&~nF" --batch --yes --passphrase %password% --decrypt "%%F")
I haven't had the opportunity to test it yet, but does this look correct? There are parts of it I'm not sure about.