backupduplicityduplicity-backup

Backup multiple folders with duplicity (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 learned that I have to specify one source directory to save and that I can adjust that with include and exclude options.

So, I could give / as source directory and exclude ** (which would sum up to nothing) and include the folders that I want to save.

Source / and --exclude / would give en empty set, --include ... beats the exclude and adds the folders. But then, I will not be able to exclude the folders I want to exclude, right? Or am I missing something?


Solution

  • I've found out that the include/exclude commands get "stronger" the more left they appear in the command.

    In my case, the imports and exports and the source would 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 added newlines:)

    --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 '**'
    /