GPG encrypt file batch script - nearly their!
Posted: 07 Oct 2010 17:45
SETLOCAL
PATH=C:\Program Files (x86)\GNU\GnuPG;%PATH%
>"%TMP%\~encryptlist.txt" DIR /B "C:\outgoingdropfolder"
PUSHD "C:\outgoingdropfolder"
FOR /F "delims=" %%F IN ('MORE ^< "%TMP%\~encryptlist.txt"') DO (
IF EXIST %%F (
ECHO bingos| GPG --batch -se --passphrase-fd 0 -r PGPTOKEY -o "C:\encryptedfiles\%F.pgp"
IF ERRORLEVEL == 0 DEL "%%F"
)
)
POPD
DEL "%TMP%\~encryptlist.txt"
ENDLOCAL
above is the script im using to try and automate GPG the above is working sort off
let me explain what i want it to do
a User can drop any type of file, called anything they like into the dropfolder, when the batch runs, i want the file (or files) to be encrypted (all with the same encryption and signing key) and then outputted to the folder called encrypted files, the file names must be the same as they were when they went in, except obviousley the new pgp extension. (i require the output to be a PGP extension)
This is what happens when i run the above batch.
I drop a file called lee.txt (10mb) into dropfolder, run the batch, the file dissapears from drop folder, and appears in the encypted files folder with the file name f.PGP ? and is only 1kb in size ?
the encryptlist.txt appears to be working fine. Im hoping that it will be able to handle more than one file ( I asume that is what the encrypt list is for ?
) however im unable to confirm as the files are becoming over written when they get to encrypted folder. If i drop 2 files at the same time then the encrypted list does pick up 2 different file names.
I can confirm that encyption and signing is working as it should, i can suucesfully decypt and verify signature using PGP, (but like i said, the file is empty)
Hope ive explained clearly enough, thanks to all that have helped me get to this stage.
Lee
PATH=C:\Program Files (x86)\GNU\GnuPG;%PATH%
>"%TMP%\~encryptlist.txt" DIR /B "C:\outgoingdropfolder"
PUSHD "C:\outgoingdropfolder"
FOR /F "delims=" %%F IN ('MORE ^< "%TMP%\~encryptlist.txt"') DO (
IF EXIST %%F (
ECHO bingos| GPG --batch -se --passphrase-fd 0 -r PGPTOKEY -o "C:\encryptedfiles\%F.pgp"
IF ERRORLEVEL == 0 DEL "%%F"
)
)
POPD
DEL "%TMP%\~encryptlist.txt"
ENDLOCAL
above is the script im using to try and automate GPG the above is working sort off
let me explain what i want it to do
a User can drop any type of file, called anything they like into the dropfolder, when the batch runs, i want the file (or files) to be encrypted (all with the same encryption and signing key) and then outputted to the folder called encrypted files, the file names must be the same as they were when they went in, except obviousley the new pgp extension. (i require the output to be a PGP extension)
This is what happens when i run the above batch.
I drop a file called lee.txt (10mb) into dropfolder, run the batch, the file dissapears from drop folder, and appears in the encypted files folder with the file name f.PGP ? and is only 1kb in size ?
the encryptlist.txt appears to be working fine. Im hoping that it will be able to handle more than one file ( I asume that is what the encrypt list is for ?
) however im unable to confirm as the files are becoming over written when they get to encrypted folder. If i drop 2 files at the same time then the encrypted list does pick up 2 different file names.
I can confirm that encyption and signing is working as it should, i can suucesfully decypt and verify signature using PGP, (but like i said, the file is empty)
Hope ive explained clearly enough, thanks to all that have helped me get to this stage.
Lee