How can I set duplicity to exclude all hidden files and folders from backing them up, without specifying each and every one of them?
3 Answers
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.
- 12,953
- 11
- 66
- 134
-
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 08: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 08:22
In duplicity's GUI ("Backup" / deja-dup), 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.
- 758
- 1
- 9
- 20
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)
- 171,743
- 65
- 311
- 401