LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Using xargs (http://www.linuxquestions.org/questions/linux-software-2/using-xargs-4175434286/)

drpartha 10-26-2012 09:41 PM

Using xargs
 
Using xargs

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

Both of these dont work. What is the way to do this ?

Cany anyone give me a clue please ? Please email me directly.

Many thanks,

partha
drpartha@gmail.com

wpeckham 10-27-2012 07:17 AM

Have you tried....
 
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 ?

Reuti 10-27-2012 10:39 AM

What about running a gpg-agent?

drpartha 10-27-2012 11:32 AM

Not so easy. But I found a way out. Will announce the details soon through the web.

Thanks,

partha


All times are GMT -5. The time now is 03:37 AM.