Expanding the include/exclude options
Adam Lazur
adam@lazur.org
Thu, 28 Mar 2002 23:36:09 -0500
Ben Escoto (bescoto@stanford.edu) said:
[ snip snip ]
> Another old request is to accept a list of files. There could be
> options --exclude-from-filelist or --include-from-filelist, so that
>
> --exclude .* --include-from-filelist listing.lst
>
> would only back up the files listed in listing.lst, and
[ snip snip ]
Well, here's my input.
The above syntax is backwards from the way I would think of it. I think
of things on the left as being encountered first in the list of things
to exclude/include.
I currently use file lists with rsync to do my backups, and am looking
at rdiff-backup to replace it. I (ab)use rsync's --exclude-from to use 2
files to handle my file lists, one that is a global list of files I
don't need to back up (*~ for example), and one that is per backed up
host to list paths to include/exclude. The global one is lower
precedence than the per hostal one, so I can override stuff in the
global one if need be.
Anyways, one of the nice features of rsync's file list handling is that
in an exclude-from file I can specify files to include (kinda non
intuitive, but it's flexible). For example, with exclude from one could
use a file with the contents of:
+ /var/spool/cron
- /var/spool
+ /var
Which means "give me all of /var except /var/spool, but I want
/var/spool/cron". It gets kind of hairy, but if you think about it as a
sequential list of patterns to include/exclude, it makes some sense.
Also note that with --exclude-from the - at the beginning of the line is
optional, same goes with --include-from but it's the + that's optional.
So basically, the first rule that matches a filename determines
exclude/include, and there's a way to intermingle your rules pretty
flexibly.
So register one vote for a file format that'll allow intermingling. I
don't really have an opinion on the cmdline syntax as I lean towards
long lists of stuff to include/exclude for my backups.
--
Adam Lazur, Cluster Monkey