toggle Cinema 12 Dec 2008

Pgp Batch Posted by Insane in Bash, Linux | No responses

I`ve made the following script , it decrypts all pgp/encrypted files and then move them into another folder.
I hope it helps someone.

#!/bin/bash
decryptEmAll(){
#file that contains your passphrase.
declare -r pfile='/pf0.dat';
#where to move the decrypted files.
declare -r outputFolder='/blackhole/';
for i in `ls /yourpath/*.pgp`;
do
echo "----------------------------------------------------\n";
#build the command.

cmd="cat $pfile"
cmd="${cmd}|"
cmd="$cmd /usr/bin/gpg --batch --no-tty --yes --passphrase-fd=0 "
cmd="$cmd --output $outputFolder${i/\.pgp/} "
cmd="$cmd --decrypt /yourpath/${i}"
eval $cmd

echo "----------------------------------------------------\n";
#wait....

sleep 20
done
}
#Call me
decryptEmAll
  • Share/Bookmark

Tags: , , ,

Promote this post

Would you like to add this post to your bookmarks? Come on, do not miss any updates and stay tuned.
Please share with us!

This entry no have comments but you can be first .

Leave a Reply ( Guest )

(*)

(will not be published) (*)