2

rdiff-backupを使用しています。本当に素晴らしいシンプルで強力なバックアップ ツールです。ただし、ワイルドカードのグロブ パターンと戦っています。私はこのディレクトリ構造を持っています:

/data/aaa/cache
/data/bbb/cache
/data/ccc/cache
etc....

各キャッシュ ディレクトリには、元のファイルとキャッシュ ファイルがあります。元のファイルには1.jpg2.png3.gif、 などの名前が付けられます。キャッシュ ファイルには、元のファイル名に何らかの文字列が付加されています。

したがって、すべての /data/*/cache ディレクトリをバックアップしますが、キャッシュ ファイルではなく元のファイルのみを含めます。

私はこのコマンドを使用しています:
rdiff-backup --exclude **/cache --include **/cache/+([0-9]).+([a-z]) /data /backup

しかし、rdiff-backup はこれを返し、私は迷っています:

Found interrupted initial backup. Removing...
Fatal Error: Last selection expression:
    Command-line include glob: **/cache/+([0-9]).+([a-z])
only specifies that files be included.  Because the default is to
include all files, the expression is redundant.  Exiting because this
probably isn't what you meant.
4

2 に答える 2

3

次の 2 段階のプロセスを実行することをお勧めします。

  1. たとえば find を使用して、除外するすべてのファイルのリストを作成します。-name "**/cache" > excludes.lst
  2. --exclude-filelist excludes.lst でリストを使用する

このようにして、 glob オプションとの戦いを回避でき、除外を完全に制御できます

于 2014-10-18T15:42:20.967 に答える
2

http://rdiff-backup.nongnu.org/rdiff-backup.1.htmlから:

   A given file is excluded by the file selection system exactly
   when the first matching file selection condition
   specifies that the file be excluded; otherwise the file is included.

...

   For instance,

          rdiff-backup --include /usr --exclude /usr /usr /backup

   is exactly the same as

          rdiff-backup /usr /backup

   because  the  include  and  exclude  directives  match exactly the same
   files, and the --include comes first, giving it precedence.

したがって、あなたの場合、--includeファイルがそこに到達した場合(つまり、以前の と一致し--excludeない場合)、--include. それがエラーメッセージが言おうとしていたことです。

目標を達成する方法については...

次の形式のパスのみを除外したいと仮定すると、次のよう/data/*/cache/[0-9]*.[a-z][a-z][a-z]?*に指定するだけです。

rdiff-backup --exclude '/data/*/cache/[0-9]*.[a-z][a-z][a-z]?*' --exclude '*' /data /backup

これはうまくいくはずです(私はテストしていません)。

于 2014-10-15T19:36:54.337 に答える