Encryption of multiple files into another directory

Viktor Dick viktordick86 at gmail.com
Sat Mar 5 21:11:40 CET 2016

On 05.03.2016 19:33, Josef Carnap wrote:
> It looks as if  the files simply were copied to folder_2. But when I try
> to open the *.docx files with Libre Office for example I can see that
> doesn't work.
> So I guess the very problem ist the missing file extension *gpg for the
> files in folder_2.
> Do you have any idea to modify the command so that the files in folder_2
> are: foo1.docx.gpg, foo2.docx.gpg, foo3.docx.gpg etc. (without renaming
> the files manually)?

the filenames are not important for the content of the files. If you run
the 'file' command on the files (i.e., "file
/media/usb/folder_2/foo1.docx"), it should tell you that these are
indeed gpg-encrypted files. You can simply rename the files to add the
'.gpg' extension if you want. The original command can be modified as

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

if you want to append the extension directly.

Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20160305/6271ef65/attachment.sig>

More information about the Gnupg-users mailing list