Ninu Ninu - 5 months ago 368
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

Adding --batch --yes

Example:

gpg --batch --yes -u me@yyyy.com -r "you@xxx.com" \
  --output "OUTPUTFILENAME.xls.pgp" -a -s -e "FILE.xls"

Complete example with passphrase file:

gpg --batch --yes --passphrase-fd 0 -u me@yyyy.com -r "you@xxx.com" \
  --output "OUTPUTFILENAME.xls.pgp" -a -s -e "FILE.xls"< \
  passphrase.txt