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
Tags: decrypt, desencriptar, pgp batch, pgp proceso lotes
