Expanding the include/exclude options

Ben Escoto bescoto@stanford.edu
Thu, 28 Mar 2002 00:03:52 -0800

Content-Type: text/plain; charset=us-ascii

One request I got a long time ago was for better include/exclude
options.  So, how about this system:

--exclude xxx works the same way it does now

--include xxx means include the files satisfying reg. expression xxx

When there are muliple exclude and includes, the order
matters, so that, for instance

--exclude /foo/.* --include /foo/bar --include /foo/baz

would mean to backup /foo/bar and /foo/baz, but not any of the other
files or directories in /foo.

    Now, one problem a user might have is to backup all their .doc
files, but they don't know which directories their .doc files would be
in.  For this, we can add the --include-dirs option, which means that
all directories should be included, so the user could try:

--exclude .* --include-dirs --include .*\.doc

This means go through and back up all the directories, but exclude all
the ordinary files, except the ones ending in .doc.  Some extra
options could be added as abbreviations, so that the above could also
be written:

--exclude-all --include-dirs --include .*\.doc

or even

--exclude-all-except-dirs --include .*\.doc

    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

--exclude-from-filelist listing2.lst --include .*\.doc

would back up everything except for the files listed in listing2.lst,
but also files ending in .doc, whether or not they where listed in the
file.  And maybe if the filename were '-' or something like that,
rdiff-backup could read stdin instead of a file on disk.

    So comments/suggestions about this system?  It would be backwards
compatible with the current --exclude system but expand what was
possible.  Two possible criticisms:

1.  It is too complicated, and constructions like

    --exclude-all --include-dirs --include .*\.doc

    are needlessly counterintuitive when "all I want to do is back up
    my .doc files."

2.  It is not complicated/flexible enough.  For instance, the find(1)
    command allows logical expressions to be combined using -and, -or,
    and -not.  This system would make it hard to backup "the device
    files that matched this expression, unless they were in that
    directory, in which case, etc...."

Ben Escoto

Content-Type: application/pgp-signature

Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Exmh version 2.5 01/15/2001