LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-26-2012, 09:41 PM   #1
drpartha
LQ Newbie
 
Registered: Apr 2012
Location: Secunderabad, India
Distribution: Suse, Ubuntu
Posts: 5

Rep: Reputation: Disabled
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
 
Old 10-27-2012, 07:17 AM   #2
wpeckham
Member
 
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix
Posts: 765

Rep: Reputation: 172Reputation: 172
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.
 
Old 10-27-2012, 09:28 AM   #3
drpartha
LQ Newbie
 
Registered: Apr 2012
Location: Secunderabad, India
Distribution: Suse, Ubuntu
Posts: 5

Original Poster
Rep: Reputation: Disabled
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 ?
 
Old 10-27-2012, 10:39 AM   #4
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,319

Rep: Reputation: 252Reputation: 252Reputation: 252
What about running a gpg-agent?

Last edited by Reuti; 10-27-2012 at 10:41 AM. Reason: Added link
 
Old 10-27-2012, 11:32 AM   #5
drpartha
LQ Newbie
 
Registered: Apr 2012
Location: Secunderabad, India
Distribution: Suse, Ubuntu
Posts: 5

Original Poster
Rep: Reputation: Disabled
Not so easy. But I found a way out. Will announce the details soon through the web.

Thanks,

partha
 
  


Reply

Tags
bash, gpg, xargs


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xargs: unmatched single quote; by default quotes are special to xargs unless you use Raakh5 Linux - Newbie 7 05-21-2014 07:26 PM
Using xargs SBN Linux - General 2 04-07-2008 07:44 PM
Xargs -i problems. Glaurung Linux - Software 2 10-25-2007 03:23 AM
`wc`, `xargs` h/w Programming 11 09-30-2007 04:22 PM
xargs yawe_frek Linux - Software 1 04-15-2007 04:26 PM


All times are GMT -5. The time now is 08:49 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration