I have a directory full of gpg encrypted files (all file names end with .gpg). I would like to decrypt all these files. The command "gpg filename" helps me do this one file at a time. I would like to scan all the files and decrypt in one go. I tired the one line scripts::
find . -name "*.gpg" | xargs gpg
OR
find . -name "*.gpg" -print0 | xargs -0 gpg

You could read the man pages for the utilities involved, there are about a dozen related ways of doing this.

Also, it is much neater if you use the tags for quote and code.

You tried

Code:

find . -name "*.gpg" | xargs gpg

I believe. Why not try

Code:

find . -name "*.gpg" -exec gpg {} \;

and see how that works: this takes the extra calls to xargs right out of the problem. Xargs is of little advantage here, since you have to execute an event for each file anyway: it really shines when you can make one call to process multiple targets.

drpartha

10-27-2012 09:28 AM

find . -name "*.gpg" -exec gpg {} \;

That works, but for each file I have to type the passphrase again and again. This could be a pain if I have too many files to decrypt. Can anyone suggest a way out / Can we make gpg use the same passphrase again without asking ?