encrypt bunch of txt files

April 20, 2011 at 17:39:55
Specs: Windows XP, 1gb
Need help with automating in .bat or vbs. I have a situation where I have to manually encrypt files because the vendor doesn’t want to pay for the license for the newer version of encryption. I can encrypt files one by one from the command line below but how do I encrypt bunch of .txts if I have more than one file in folder?
this is what they have provided us. no option to encrypt more than one file at time
pgp -e "c:\documents and settings\user\pgp\chart.txt" 0x124E6658 --this is for single .txt file

thanks

how do i to do it .bat or vbs?


See More: encrypt bunch of txt files

Report •


#1
April 20, 2011 at 18:37:14
Do you need a new version of encryption? Why can't you buy your own?

Report •

#2
April 21, 2011 at 03:26:49
for %%j in (*.txt) do @pgp -e "C:\documents and settings\user\pgp\%%j" 0x124E6658 --

To run directly from prompt replace %%j with %j.

Report •

#3
April 21, 2011 at 05:47:03
That’s excellent IVO. That script works if there is 1.txt and 2.txt but what if the user dump files with random name? will it still work?

Report •

Related Solutions

#4
April 21, 2011 at 06:24:19
The statement works for any file suffixed .txt no matter its name or its position in a bunch.

Report •

#5
April 21, 2011 at 13:44:25
IVO I have noticed it pgp the files but it bombs when it comes to last file. Example: It pgps 1.txt and 2.txt but errors out with 3.txt. Also can I delete .txt after it pgp it?

thanks


Report •

#6
April 22, 2011 at 02:42:25
I don't know PGP tool but assure the script implements a well known method to work around the issue you face. The following version deletes the *.txt files after they are encrypted (I assume the encrypted file gets a different extension, e.g. 1.txt --> 1.xyz) and handles the file path in a bit neater way. Why you face the error processing the last file I don't know.

@echo off
pushd C:\documents and settings\user\pgp
for %%j in (*.txt) do pgp -e "%%j" 0x124E6658 --
del *.txt
popd


Report •


Ask Question