9

I'm using duplicity to backup some of my files. The man page is kind of confusing, regarding the include/exclude Patterns. I'd like to backup the following things:

/storage/include
/otherthings

but NOT

/storage/include/exclude

The Include-File currently looks:

+ /storage/include
- /storage/include/exclude
+ /otherthings
- ** 

Duplicity is called as followed:

/usr/bin/duplicity --include-globbing-filelist /Path/to/file/above / target

It simply doesn't work. Every time it backups, it also includes the files in /storage/include/exclude.

| improve this question | | | | |
  • How do you know that is the syntax of the include-file? Also, maybe this would work: duplicity --exclude-filelist "/Path/to/filelist/without-or+/to-exclude" / target. (note: I don't use duplicity, just a suggestion based on the manual page I found) – JMCF125 Mar 2 '14 at 12:00
9

The file selection section of the duplicity man page states:

Each file selection condition either matches or doesn’t match a given file. 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.

This relates to the --include / --exclude command line options priority, but the manual page later you find the relevant info for the --include-globbing-filelist option you use:

The --include-globbing-filelist and --exclude-globbing-filelist options also 
specify filelists, but each line in the filelist will be interpreted as a
globbing pattern the way --include and --exclude options are interpreted
(although "+ " and "- " prefixing is still allowed). For instance, if the
file "globbing-list.txt" contains the lines:

    dir/foo
    + dir/bar
    - ** 

Then --include-globbing-filelist globbing-list.txt would be exactly the same
as specifying --include dir/foo --include dir/bar --exclude ** on the command
line. 

What happens is that /storage/include/exclude matches the first line, it therefore it is included. You should in general use more specific statements before less specific ones. The following should work for you:

- /storage/include/exclude
+ /storage/include
+ /otherthings
- ** 
| improve this answer | | | | |
  • Nice. It works. One more question: If i only want to exclude, say "txt"-Files in the exclude-Directory. How do i do this? - /storage/include/exclude/*.txt didn't work – int2000 Mar 2 '14 at 14:56
  • @int2000 That should IMHO work, but such patterns are not explicitly tested. So there might be an issue. Could you use /storage/include/exclude/**.txt, or at least try if that works. If not you might have found a bug in the matching code in selection.py – Anthon Mar 2 '14 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.