Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 339
Kurtibert Avatar asked Nov 11 '15 10:11

Kurtibert


2 Answers

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 '**'
/
like image 195
Kurtibert Avatar answered Nov 03 '22 09:11

Kurtibert


To complete the answer of @Kurtibert, you need to add ** at the end of the directory you include to be sure files inside are included (and don't forgot 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 '**'
/
like image 23
Kartoch Avatar answered Nov 03 '22 08:11

Kartoch