Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I set duplicity to exclude all hidden files and folders from backing them up, without specifying each and every one of them?

Thank you

share|improve this question
up vote 6 down vote accepted

A hidden file or directory starts with a dot (e.g. .bash_history, .cache/). The pattern for that is .*, so you can use the --exclude '.*' option to exclude hidden files and directories. This option must come before other --include patterns because:

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.

(from man duplicity)

share|improve this answer

The decision by the developer is to keep the options very simple. This has been requested several times, here and here are some bug reports/feature requests on the issue.

An easier way to achieve what you want is to add just the directories (/Documents, /Music, /Pictures, etc...) individually, instead of selecting the entire /Home directory. You likely have 10 or less folders in your /Home directory, so this is easier then manually excluding all the hidden folders and files.

It's a good question, but the answer is to use a workaround.

share|improve this answer
When excluding certain folders like --include Documents --include Music, do not forget to append --exclude '*' on the end or files will be included anyway. – Lekensteyn Feb 10 '12 at 21:02
@Lekensteyn Good point. My answer is more geared for people like me who use duplicity via the 'Backup' GUI-based app. I actually upvoted your answer as it's the better one, but I see others have now upvoted mine. Bottom line is if people are setting this up via terminal they need to make sure the exclude command is used, right? – Tom Brossman Feb 11 '12 at 8:07
I upvoted yours as well since it actually contains valuable information. It took me a minute to figure out that the --exclude '*' command is necessary, so hopefully I save others time now. – Lekensteyn Feb 11 '12 at 8:22

In duplicity's GUI ("Backup"), if you want to list dot-file in your excluded files, you may be having difficulty selecting them via the GUI. Click on the plus ("+") icon under "Folders" tab and whichever category you wish (e.g. "Folders to ignore" category). This brings up a file browser. If you want to select dot files (ie, "hidden files"), just right-click in some empty space in this file browser and choose "show hidden files". Now you can make use of ctrl-click or shift-click to select some or many or all of your dot files explicitly. This does NOT answer the question, but the other answers referred to command line non-solutions. This is a GUI non-solution.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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