Advanced rsync includes and excludes

Hans-Peter Jansen hpj at urpla.net
Wed Aug 7 16:58:00 UTC 2019


Am Mittwoch, 7. August 2019, 17:36:01 CEST schrieb Kevin Korb via rsync:
> I believe you can shorten that to:
> 
> + /some/very/
> + /some/very/deep/
> + /some/very/deep/path/
> + /some/very/deep/path/to/
> + /some/very/deep/path/to/save/***
> - /some/*

Unfortunately, this doesn't work, since it picks up everything in /some/very/, 
/some/very/deep/, and so on.

> You could also exclude /some and then use /some/very/deep/path/to/save
> as an additional source.  I don't know if rsnapshot can handle multiple
> sources in 1 rsync but rsync itself can.

No, it would need different backup jobs then...

Well, looks like my scheme from below is still the best way to handle such 
cases. 

Anyway, thanks for your feedback, Kevin.

Cheers,
Pete
 
> On 8/7/19 9:54 AM, Hans-Peter Jansen via rsync wrote:
> > Hi,
> > 
> > I'm a happy camper @ rsync (and rsnapshot) since years. Thanks for this
> > major piece of software.
> > 
> > In an attempt to reorganize my rsnapshot backups, I stumbled across an
> > issue, that I'm trying to seeking a more sophisticated solution here.
> > 
> > Given, I have a deeply branched tree, where I would like to include a
> > specific directory deep under, while excluding anything else on that
> > path, I find myself doing:
> > 
> > + /some/
> > + /some/very/
> > + /some/very/deep/
> > + /some/very/deep/path/
> > + /some/very/deep/path/to/
> > + /some/very/deep/path/to/save/
> > - /some/very/deep/path/to/*
> > - /some/very/deep/path/*
> > - /some/very/deep/*
> > - /some/very/*
> > - /some/*
> > 
> > While it works, it feels rather awkward and gets very complicated, if you
> > have more of such items to deal with. Sure, I could run this separately,
> > but this isn't the real McCoy either with a complicated tree structure.
> > 
> > What are your favorite ways of doing such tasks with rsync?
> > 
> > Thanks in advance,
> > Pete







More information about the rsync mailing list