--exclude-filelist and shell patterns

Ben Escoto bescoto@stanford.edu
Sun, 02 Jun 2002 00:16:20 -0700

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

>>>>> "DG" == dean gaudet <dean-list-rdiff-backup@arctic.org>
>>>>> wrote the following on Sat, 1 Jun 2002 18:40:13 -0700 (PDT)

  DG> hmm... is there any way to give a list of extended shell
  DG> patterns in a file?

Well, suppose you have a list of shell patterns in file FILE.  You
could say:

    EXCLUDES=`xargs -ri echo --exclude \'{}\' <FILE`
    eval rdiff-backup $EXCLUDES source_dir dest_dir

Not very elegant though...  (Maybe some shell guy can think of a
better way?)

  DG> i want to put patterns like:

  DG> /tmp/* /var/tmp/* /home/*/tmp/* /proc/*

  DG> into a file and have them exclude the contents of the
  DG> directories without excluding the directories themselves (so
  DG> that it is easier to do a full restore in the future).

  DG> these work with --exclude on the command line, but not if i put
  DG> them into a --exclude-filelist file.

I thought that file lists would usually be generated by some process
like find, and quoting problems could be avoided by not interpreting
the filelist.  But now that you mention it, files containing newlines
can still screw up the process.

    It seems the best way to handle this would be to scan the
filelist, and assume that the first of \0 and \n is the file
separator.  That should allow the use of find -print0, and still work
in 99.99% of all cases.  Or maybe there should be a --null-separator
switch, to override to \0, and this could also determine the
directory_statistics separator...

Ben Escoto

Content-Type: application/pgp-signature

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