I wish to backup with duplicity (I use it often, usually without issues) /etc and /root. I wish to exclude .cache from the /root directory. I try:

duplicity incremental --full-if-older-than 30W --include /etc \
  --include /root --exclude '/root/.cache' --exclude / \
  --verbosity info / scp://TARGET

This generally works, but /root/.cache is included within backup. Instead of the '/root/.cache' I tried different expression patterns: /root/.cache, "/root/.cache", "**.cache", '**.cache', ''**.cache'' and several others, with same result.

According to duplicity manual (I have 0.7.12 on openSUSE), expression "**.cache" should work well. Do I misread the manual or do I do something wrong?

1 Answer 1



order matters when excluding in duplicity. the parameters are used in the order given. in your example '/root/.cache' is compared to

--include /etc
--include /root <-- and matches here
--exclude '/root/.cache'
--exclude /

try to move the specific exclusion in front of the more general include eg.

--include /etc
--exclude /root/.cache
--include /root
--exclude /**

that should work. moving the cache out the root's home folder would work as well of course.

btw. file selection has it's own section in the duplicity man page http://duplicity.nongnu.org/duplicity.1.html#sect9

wrt. to **.cache, yes. it will work, but will exclude any path named '.cache' in the end. if you want the exact name you should use **/.cache.

finally, there is the --exclude-if-present parameter, which can be quite handy if there are just some folders to be excluded.

--exclude-if-present filename
Exclude directories if filename is present. Allows the user to specify folders that they do not wish to backup by adding a specified file (e.g. ".nobackup") instead of maintaining a comprehensive exclude/include list. This option needs to come before any other include or exclude options.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .