rsync : how to exclude specific files or folders ?

Hal Burgiss hal at burgiss.net
Sat Feb 28 22:22:15 UTC 2009


On Sat, Feb 28, 2009 at 10:46:06PM +0100, Vincent Trouilliez wrote:
> 
> The problem is that although it should be simple.. it isn't.
> I read the man page several times, and it's not very clear what the
> syntax is, nor if individual folders to be exluced can be specified
> directly at the command line, or if they need to be specified in a
> separate "black list" file, and what the syntax in this file should be
> like.
> 
> So does anyone know (for sure, from past or present
> experience) how to word it so rsync understands ?
> 
> To be specific, I am trying to exlude my virtual machines (15GB) and
> googlearth database (1.1GB) :
> 
> /home/vincent/.VirtualBox
> /home/vincent/.googleearth

This is my solution. And yes the syntax is onery. Use rsync with the
-F option. It think will use a .rsync-filter file. I place this in /,
but I backup most of the system. By default everything is included, so
I do simple exclusions. Some examples, that work for me:

- /mnt/media

- /var/tmp/*
- /var/cache/*
- */_htdocs/
- */logs/*

The '*' is a wildcard and will ignore a directory named _htdocs
anywhere it finds one.

There are other ways to use filters, but I found this and it works. So
something like this should work:

- /home/vincent/.VirtualBox
- /home/vincent/.googleearth

-- 
Hal





More information about the ubuntu-users mailing list