rsync : how to exclude specific files or folders ?
H.S.
hs.samix at gmail.com
Sat Feb 28 23:33:41 UTC 2009
Vincent Trouilliez wrote:
> Hello,
>
> I am using rsync currently, to backup my home directory every evening.
> I would like to exclude a few large folders so as to speed up the backup
> by an order (or two) of magnitude.
>
> 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
>
Fast solution, exclude using --exclude=. For example, in your case, use
the following additional flags and see what happens:
-n --exclude="/home/vincent/.VirtualBox"
--exclude="/home/vincent/.googleearth"
That "-n" will just do a dry run. Remove that flag when you are
satisfied with what will be transfered.
Alternative is to use an excludes file. Use the following options
assuming you have exclude patterns in /path/to/excludes.txt
--exclude-from=/path/to/excludes.txt
where excludes.txt has the lines:
#-----------------------------------------
#exclude some large unnecessary files/dirs
- .VirtualBox
- .googlearth
#-----------------------------------------
These two lines exclude any similarly named file or folder irrespective
of their paths.
Search google for more information about exclude and include files.
Good luck.
--
Please reply to this list only. I read this list on its corresponding
newsgroup on gmane.org. Replies sent to my email address are just
filtered to a folder in my mailbox and get periodically deleted without
ever having been read.
More information about the ubuntu-users
mailing list