Ninu Ninu - 1 year ago 1282
Linux Question

How to overwrite a gpg output file without prompt(automatically)?

I would like to know how to overwrite an output file with gpg encryption?
if i have the same filename in the target directory it fails decryption
the command that i use to decrypt is :

gpg --passphrase-fd 0 -o D:/Notification/mytest.txt --batch --passphrase-file D:/passphrase.txt -d D:/Notification/mytest.gpg

In this case, it wouldn't overwrite the mytest.txt file, so each time i need to delete the contents of the Directory(D:/Notification) when i execute the script.

Is there any option to overwrite the output fie?

Answer Source

Adding --batch --yes


gpg --batch --yes -u -r "" \
  --output "OUTPUTFILENAME.xls.pgp" -a -s -e "FILE.xls"

Complete example with passphrase file:

gpg --batch --yes --passphrase-fd 0 -u -r "" \
  --output "OUTPUTFILENAME.xls.pgp" -a -s -e "FILE.xls"< \
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download