Backing up multiple folders with duplication (including / excluding)

I would like to backup the following folders with duplicity

/home /etc /usr/local /root /var /boot 

and exclude

 /var/tmp /var/run /var/lock /home/*/.thumbnails /home/*/.cache /home/*/.local/share/Trash /root/.thumbnails /root/.cache /root/.local/share/Trash 

I already found out that I need to specify one source directory to save and that I can configure it with the include and exclude parameters.

So, I could give / as the source directory and exclude ** (that would mean nothing) and include the folders that I want to keep.

The source / and --exclude / will give an empty set, --include ... superior to exclude and adds folders. But then I can’t exclude the folders that I want to exclude, right? Or am I missing something?

+6
source share
2 answers

I found out that the include / exclude commands become "stronger" the more left in the command.

In my case, import and export and the source will look like this: --exclude /var/tmp --exclude /var/run --exclude /var/lock --exclude /home/*/.thumbnails --exclude /home/*/.cache --exclude /home/*/.local/share/Trash --exclude /root/.thumbnails --exclude /root/.cache --exclude /root/.local/share/Trash --include /home --include /etc --include /usr/local --include /root --include /var --include /boot --exclude '**' /

(With the addition of new lines :)

 --exclude /var/tmp --exclude /var/run --exclude /var/lock --exclude /home/*/.thumbnails --exclude /home/*/.cache --exclude /home/*/.local/share/Trash --exclude /root/.thumbnails --exclude /root/.cache --exclude /root/.local/share/Trash --include /home --include /etc --include /usr/local --include /root --include /var --include /boot --exclude '**' / 
+7
source

To follow @Kurtibert's answer, you need to add ** to the end of the directory that you included to make sure the files inside are included (and don't forget the quotes):

 --exclude '/var/tmp' --exclude '/var/run' --exclude /var/lock' --exclude '/home/*/.thumbnails' --exclude '/home/*/.cache' --exclude '/home/*/.local/share/Trash' --exclude '/root/.thumbnails' --exclude '/root/.cache' --exclude '/root/.local/share/Trash' --include '/home/**' --include '/etc/**' --include '/usr/local/**' --include '/root/**' --include '/var/**' --include '/boot/**' --exclude '**' / 
0
source

All Articles