Previous Section  < Day Day Up >  Next Section

Recipe 16.8. Fine-Tuning File Selection

16.8.1 Problem

You would like to exclude some files (such as .tmp and .bak files) from being backed up, or you would like to create a list of included files.

16.8.2 Solution

Put your file lists in files, then call them with rsync's --exclude-from or —include-from options.

The files can contain a list of files, regular expressions, or both:

*.tmp

*.temp

*.bak

/etc/skel

/etc/local

Then add the --exclude-from or —include-from option on the rsync command line:

$ rsync -ae ssh /home /etc --exclude-from=~/exclude-list backup.test.net:/home-etc

16.8.3 Discussion

It's best to use only one or the other; using both options is the fast track to confusion.

16.8.4 See Also

  • rsync(1)

    Previous Section  < Day Day Up >  Next Section