rsyncing Maildirs

Hardy Merrill hmerrill at redhat.com
Fri Nov 7 01:42:21 EST 2003


jw schultz [jw at pegasys.ws] wrote:
> On Thu, Nov 06, 2003 at 10:48:37AM +0100, Snorre Narum Garmann wrote:
> > Hi
> > 
> > I'm trying to take a backup of all the users emails on a server using rsync,
> > but there is probably something about the patterns I haven't understood
> > quite.
> > 
> >  
> > 
> > Every user has a folder called Maildir in their home directory.
> > 
> >  
> > 
> > So the structure is like this:
> > 
> > /home/user1/Maildir
> > 
> > /home/user2/Maildir
> > 
> > etc.
> > 
> >  
> > 
> > I'm not interested in backing up the other folders that the users might
> > have.
> > 
> >  
> > 
> > The "mailbackup" share points to the /home folder so I'm trying the
> > following without success:
> > 
> >  
> > 
> > rsync -av --include "/*/Maildir/**" --exclude "*" -recursive
> > server::mailbackup .
> > 
> >  
> > 
> > This backs up nothing. Why doesn't this work? Could anyone enlighten me?
> 
> Because you failed to include the parent directories all the
> way up the line.  Read the manpage section on EXCLUDE
> PATTERNS.  I'd use --exclude-from because you will need more
> patterns than one normally wants on the command-line.

According to what jw suggested for including the parent
directories, this is what I tried and I think it worked -
I've modified the directories from my test to correspond
to yours:

rsync-include-file
------------------
+ /*/
+ /*/Maildir/
+ /*/Maildir/**
- /**


rsync -av --include-from=rsync-include-file server::mailbackup .

HTH.
-- 
Hardy Merrill
Red Hat, Inc.



More information about the rsync mailing list