How to exclude all hidden files and folders from duplicity backup
How can I set duplicity to exclude all hidden files and folders from backing them up, without specifying each and every one of them?
Solution 1:
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.
Solution 2:
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.
Solution 3:
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)