Encryption of multiple files into another directory

Peter Lebbing peter at digitalbrains.com
Sat Mar 5 12:12:01 CET 2016


On 05/03/16 10:34, Josef Carnap wrote:
> How can I encrypt alle the files in this directory to another directory
> folder_2?

On Linux:

for x in /media/usb/folder_1/*; do gpg2 -o "/media/usb/folder_2/$(basename "$x")" -r 0x12345678 -e "$x"; done

You can do progressively more complicated stuff as well. The program 
"find" is your friend, and

"$(echo "$x" | sed 's+^/media/usb/folder_1/+/media/usb/folder_2/+')"

can be used for more complicated pathname changes in other situations. 
Note that I used a plus as substitute command delimiter because slash 
is already in the strings, and that I anchored it at the start of $x 
by including a hat operator (^).

On Windows: I haven't got a clue ;).

HTH,

Peter.

-- 
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <http://digitalbrains.com/2012/openpgp-key-peter>



More information about the Gnupg-users mailing list