Encrypting SubFolders

Ryan Malayter rmalayter at bai.org
Thu Mar 10 18:29:16 CET 2005


Didn't think about that recursion problem.

The for command can parse the file extensions using the variable modifer
"~x". This is described near the bottom of the FOR help screens.

You can then use the IF NOT command to see if the file to be encrypted
is already a GPG file, like so:

   FOR /R c:\temp %f IN (*) DO IF NOT %~xf==gpg gpg --encrypt %f

As you mentioned, you need to replace the % with %% if you're going to
use this inside a batch file.

Regards,
	Ryan

> -----Original Message-----
> From: gnupg-users-bounces at gnupg.org 
> [mailto:gnupg-users-bounces at gnupg.org] On Behalf Of jediknight2
> Sent: Thursday, March 10, 2005 8:18 AM
> To: gnupg-users at gnupg.org
> Subject: Re: Encrypting SubFolders
> 
> That line works, but it starts encrypting the .gpg then the 
> .gpg.gpg then
> the .gpg.gpg.gpg :) I cant find any --exclude option that 
> works...I actually
> had to add a % sign so it reads
> 
> For /R c:\temp %%f IN (*) DO gpg --encrypt %%f
> 
> 
> 
> 
> 
> 
> 
> 
> FYI, on windows the command would be:
> 
>     FOR /R c:\temp %f IN (*) DO gpg --encrypt %f
> 
> Obviously, you can replace C:\temp with a relative path, UNC, or
> whatever else you'd like.
> 
> I think you need Win98 or newer to have the FOR command 
> available in the
> command shell.
> 
> Regards,
> 	Ryan
> 
> 
> 
> > -----Original Message-----
> > From: gnupg-users-bounces at gnupg.org 
> > [mailto:gnupg-users-bounces at gnupg.org] On Behalf Of David T Kerns
> > Sent: Wednesday, March 09, 2005 2:14 PM
> > To: Atom Smasher
> > Cc: gnupg-users at gnupg.org; gnupg-users-bounces at gnupg.org
> > Subject: Re: Encrypting SubFolders
> > 
> > I'm new to gpg so not sure if gpg has a recursion flag, but on unix:
> > 
> > gpg --encrypt --multifile `find /thisfolder -type f -print`
> > 
> > should work.
> > 
> > 
> > 
> >                                                               
> >                                                               
> >           
> >                          Atom Smasher                         
> >                                                               
> >           
> >                          <atom at smasher.org>     To:    
> > gnupg-users at gnupg.org                                         
> >                  
> >                          Sent by:               cc:           
> >                                                               
> >           
> >                          gnupg-users-bounces at g  Subject: Re: 
> > Encrypting SubFolders                                         
> >            
> >                          nupg.org                             
> >                                                               
> >           
> >                                                               
> >                                                               
> >           
> >                                                               
> >                                                               
> >           
> >                          03/09/2005 02:06 PM                  
> >                                                               
> >           
> >                                                               
> >                                                               
> >           
> >                                                               
> >                                                               
> >           
> > 
> > 
> > 
> > 
> > On Tue, 8 Mar 2005, jediknight2 wrote:
> > 
> > > Is there a way to encrypt a folder including subfolders?
> > >
> > > I have tried
> > > gpg --encrypt --multifile \thisfolder\*.*
> > \thisfolder\*
> > >
> > > The first one will hit all the subfolders inside 
> > thisfolder, but if those
> > > subfolders have folders then it wont go...
> > >
> > > so it will try thisfolder\subfolder
> > > but it wont catch thisfolder\subfolder\subsubfolder
> > >
> > > Any suggestions
> > ==========================
> > 
> > windows or *nix?
> > 
> > 
> > --
> >          ...atom
> > 
> >   _________________________________________
> >   PGP key - http://atom.smasher.org/pgp.txt
> >   762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
> >   -------------------------------------------------
> > 
> >              "Somebody has to take governments' place, and business
> >               seems to me to be a logical entity to do it."
> >                          -- David Rockefeller
> >                          Newsweek International, Feb 1 1999.
> > 
> > 
> > 
> > _______________________________________________
> > Gnupg-users mailing list
> > Gnupg-users at gnupg.org
> > http://lists.gnupg.org/mailman/listinfo/gnupg-users
> > 
> > 
> > 
> > 
> > 
> > 
> > -----------------------------------------
> > **************************************************************
> > **********
> > This E-mail is confidential. It may also be legally 
> privileged. If you
> > are not the addressee you may not copy, forward, disclose or 
> > use any   part
> > of it. If you have received this message in error, please 
> > delete   it and
> > all copies from your system and notify the sender immediately 
> >   by return
> > E-mail.     Internet communications cannot be guaranteed to 
> be timely,
> > secure,   error or virus-free. The sender does not accept 
> > liability for any
> > errors or omissions.
> > **************************************************************
> > **********
> > 
> > 
> > _______________________________________________
> > Gnupg-users mailing list
> > Gnupg-users at gnupg.org
> > http://lists.gnupg.org/mailman/listinfo/gnupg-users
> > 
> 
> 
> 
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
> 



More information about the Gnupg-users mailing list