Encrypting in a directory

Steve Butler sbutler@fchn.com
Wed Apr 17 00:21:02 2002

It's very close in *NIX:

for i in *
  gpg --passphrase-fd 0 -o gpg_save/$i --symmetric $i < passphrase.txt

This presumes that gpg_save is a subdirectory to the directory where this
This gives one file out for each file in.  If the desire is a single
encrypted file for all files in the directory then:

  tar -czf my_dir.tar .
  gpg --passphrase-fd 0 -o my_dir.tar.pgp -- symmetric my_dir.tar <

I am presuming that a *doze user would use PKZIP or equivalent instead of

-----Original Message-----
From: Alan Frank [mailto:alf@matchups.com]
Sent: Tuesday, April 16, 2002 2:27 PM
To: gnupg-users@gnupg.org
Subject: Encrypting in a directory

In Windows, first put your passphrase in a file, say passphrase.txt.
Then (all on one line, and caution: I have not tested this),
   for %i in (*.* ) do gpg --passphrase-fd 0 -o gpg\%i --symmetric %i <
The DOS for command will execute a line for multiple files, substituting
the filename for %i throughout.
The --passphrase-fd 0 will read the passphrase from standard input, which
is redirected later with < .
-o sets the output file to a subdirectory (which you should create first)
so that the for command will not attempt to call gpg for the newly-created
.gpg files

I'm confident that Linux/Unix, etc. have a similar command, but due to the
exigencies of employment, I'm not as familiar with them as with MSW.

--Alan Frank

Edmund Lindmayer wrote:

> I want to encrypt a all files in a directory with gpg --symmetric in a
> single pass.  Is this possible, and how to do it?

Gnupg-users mailing list

CONFIDENTIALITY NOTICE:  This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.