Discussion:
PGP wildcards on command line?
(too old to reply)
i***@ihatespam.com
2004-09-15 22:12:18 UTC
Permalink
I have several text and xml files I need to PGP on a daily basis via a
DOS batch file. The filenames always change so I need to be able to
use a wildcard from a batch file to PGP all of them. (example c:\PGP
*.txt)

I currently use PGP 6.5.8 by Network Associates and it does not allow
me to use wildcards.

I then found MPGP version 1.1 (from 1996!) and it does allow wildcards
(appears to be the main reason it was written). The only problem is
my files are longer than 8 characters and this application truncates
the resulting .PGP filename.

Does anyone have a solution so that I can PGP these files via a
wildcard and retain my filenames? Example: "This is a test.txt"
should be "This is a test.txt.pgp". Of course I never know the
filename so I have to use wildcards.

Thanks!
Ylan Segal
2004-09-15 23:18:52 UTC
Permalink
***@ihatespam.com wrote:
| I have several text and xml files I need to PGP on a daily basis via a
| DOS batch file. The filenames always change so I need to be able to
| use a wildcard from a batch file to PGP all of them. (example c:\PGP
| *.txt)

Have you tried gnupg? I don't know if it has the functionality you are
looking for, but I would give it a try.

Ylan.
Johan Wevers
2004-09-16 18:50:16 UTC
Permalink
Post by Ylan Segal
Have you tried gnupg? I don't know if it has the functionality you are
looking for,
No, it uses the Unix philosophy: do only one thing, and do it good. For
wildcards to address multiple files there are shell functions. No need
for GnuPG to duplicate that.
--
ir. J.C.A. Wevers // Physics and science fiction site:
***@vulcan.xs4all.nl // http://www.xs4all.nl/~johanw/index.html
PGP/GPG public keys at http://www.xs4all.nl/~johanw/pgpkeys.html
Neil W Rickert
2004-09-16 00:15:07 UTC
Permalink
Post by i***@ihatespam.com
I have several text and xml files I need to PGP on a daily basis via a
DOS batch file. The filenames always change so I need to be able to
use a wildcard from a batch file to PGP all of them. (example c:\PGP
*.txt)
You could probably use something like

for %i in (*.txt) do pgp -bs %i

- From a .BAT file, you need to double up the "%".

I haven't checked, but this might only use 8.3 names. Maybe consider
installing a windows version of bash or similar shell to do the wild
card expansion on the command line.
Wimbo
2004-09-17 14:35:12 UTC
Permalink
Post by i***@ihatespam.com
I have several text and xml files I need to PGP on a daily basis via a
DOS batch file. The filenames always change so I need to be able to
use a wildcard from a batch file to PGP all of them. (example c:\PGP
*.txt)
SNIP
Post by i***@ihatespam.com
Does anyone have a solution so that I can PGP these files via a
wildcard and retain my filenames? Example: "This is a test.txt"
should be "This is a test.txt.pgp". Of course I never know the
filename so I have to use wildcards.
Thanks!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I had the same problem, but worked around it by putting the files in
an archive (commandline version of RAR), encrypt it with PGP
(commandline), and upload the encrypted file to a server.
Only 'downside' is that you have to unpack the archive to view / read
them.

Wimbo
SithTracy
2004-09-18 23:55:13 UTC
Permalink
Here is a sample I use to decrypt and PGP file in a directory... you can
rewrite it to do an encrypt:

syntax = commandfile.cmd passphrase
(note, the passphrase as a %1 variable only works if you don't have spaces
in your passphrase)

set JOB=PGPFILES
set KEY=mykeyid
set PASS=%1
set OPT=--use-embedded-filename --local-user %KEY% --passphrase-fd 0
if NOT exist "D:\%JOB%\Data" mkdir "D:\%JOB%\Data
cd /d D:\%JOB%
if exist "D:\%JOB%\*.pgp" move *.pgp .\Data
if exist "D:\%JOB%\*.asc" move *.asc .\Data
if exist "D:\%JOB%\*.gpg" move *.gpg .\Data
cd /d D:\%JOB%\Data
dir D:\%JOB%\Data\*.pgp,*.asc,*.gpg /b/s>D:\%JOB%\%JOB%.tmp
for /F "tokens=*" %%a in (D:\%JOB%\%JOB%.tmp) do (
echo %PASS%|gpg %OPT% --batch --yes --no-mdc-warning --skip-verify "%%a"
)
if exist "D:\%JOB%\DATA\*.pgp" move *.pgp ..
if exist "D:\%JOB%\DATA\*.asc" move *.asc ..
if exist "D:\%JOB%\DATA\*.gpg" move *.gpg ..

If you need more help or ideas, try alt.msdos.batch.nt

Good luck...

SithTracy
Post by i***@ihatespam.com
I have several text and xml files I need to PGP on a daily basis via a
DOS batch file. The filenames always change so I need to be able to
use a wildcard from a batch file to PGP all of them. (example c:\PGP
*.txt)
I currently use PGP 6.5.8 by Network Associates and it does not allow
me to use wildcards.
I then found MPGP version 1.1 (from 1996!) and it does allow wildcards
(appears to be the main reason it was written). The only problem is
my files are longer than 8 characters and this application truncates
the resulting .PGP filename.
Does anyone have a solution so that I can PGP these files via a
wildcard and retain my filenames? Example: "This is a test.txt"
should be "This is a test.txt.pgp". Of course I never know the
filename so I have to use wildcards.
Thanks!
Loading...