how to sign files inside a folder?

Steven W. Orr steveo at syslang.net
Wed May 27 14:23:51 CEST 2009


On Tuesday, May 26th 2009 at 23:38 -0000, quoth John Clizbe:

=>Faramir wrote:
=>> Hello,
=>> 	I saw a question in the support list in Spanish language, and it is
=>> about how to sign files inside a folder, in Windows OS, without using
=>> additional tools. The goal is to have a tree of folders, with files
=>> inside, and to sign individually each file (with detached signature, if
=>> I am not wrong).
=>> 
=>> 	Since I have never had to do something like that, I don't have the
=>> faintest idea about how to do it, if it is possible to do it.
=>> 
=>>         Compressing the folder an signing the compressed file is what
=>> the person behind the question wants to avoid.
=>
=>I saw that one.
=>
=>I don't know about doing it "without using additional tools". The
=>windows CMD shell doesn't give one a boatload of useful commands.
=>
=>I'd pull the RC1 of MSYS 1.0.11 cause this is a snap with bash and find.
=>Using his .TXT example:
=>
=>cd <top folder>
=>for file in $(find . -name \*.[tT][xX]][tT] -print);	\
=>  do echo $file; 						\
=>  gpg --passphrase deafbeef -u 0xdecafbad -sb $file ; \
=>done

fyi, that's why they invented -iname option. :-)

for file in $(find . -iname \*.txt -print);

the semi is not needed.

But if the list of filenames is large, you could end up overflowing your 
shell buffer. Another way to do it that would prevent that from 
happening...

find . -iname \*.txt -print | 
while read file
do
  echo $file
  gpg --passphrase deafbeef -u 0xdecafbad -sb $file
done

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



More information about the Gnupg-users mailing list