Nice, I haven't used --include/exclude before, but I have a use case now
so I want to try it.
How do I make this work on Windows where there isn't (AFAIK) a common
root for all the drives? For example I want to do
rdiff-backup \
--include C:/from1 \
--exclude C:/from1/exclude1 \
--exclude C:/from1/exclude2 \
--include H:/from2 \
--exclude H:/from2/exclude3 \
--include C:/from3 \
sourcedir \\nas4free\my-backup.rdiff-backup
but I don't know what I can use for sourcedir that will allow me to
include directories from both C: and H:. The 3 included directories are
all logically related so I prefer to back them up to a single
repository. Is there a way to do this on Windows?
On 2023-01-09 12:30, EricZolf ewl+rdiffbackup-at-lavar.de
|rdiff-backup-users| wrote:
Order does indeed matter _ and_ there is an implicit include "all" at
the end, so that the slightly simpler following command should also work:
rdiff-backup --terminal-verbosity 5 \
--include /tmp/from/.2 \
--exclude /tmp/from/.\* \
--exclude /tmp/from/2 \
/tmp/from ./to.
It basically depends if you want to save the full path or not.
K R, Eric.
On January 9, 2023 11:42:10 AM UTC, Tobias Leupold <tl@stonemx.de>
wrote:
Yay, I made it :-D ;-)
The --include and --exclude order actually DOES matter.
If invoked like so:
rdiff-backup --terminal-verbosity 5 \
--include /tmp/from/.2 \
--exclude /tmp/from/.\* \
--exclude /tmp/from/2 \
--include /tmp/from/\* \
--exclude / \
/ ./to
I get what I want:
Processing changed file .
Processing changed file tmp
Processing changed file tmp/from
Processing changed file tmp/from/.2
Processing changed file tmp/from/1
Processing changed file tmp/from/3
A bit hard to figure out, but it works!
Thanks again for helping!
Am Montag, 9. Januar 2023, 10:31:53 CET schrieb Tobias Leupold:
Hi Eric!
Thanks for yout reply!
The problem is that I don't know the complete list of the "normal"
folders I want to include. But I know a complete list of dotfiles I
want
to include.
So, if we have
/tmp/from/1
/tmp/from/2
/tmp/from/3
/tmp/from/.1
/tmp/from/.2
/tmp/from/.3
I want to exclude all the files starting with a ., but include a list
of
specific files starting with a ".", e.g. /tmp/from/.2 (at this point,
it's not a problem yet I think ...).
But I also want to include all the regular files and folders from
/tmp/from, with e.g. the exception of /tmp/from/2. But I don't know the
list to include. And that's the problem -- there could also be
/tmp/from/4, /tmp/from/5 and so on.
Now if I do
rdiff-backup \
--include /tmp/from/\* \
--exclude /tmp/from/2 \
--include /tmp/from/.2 \
--exclude /tmp/from/.\* \
--exclude / \
/ ./to
all the files from /tmp/from are included (also /tmp/from/2 and all the
/tmp/from/.whatever files) no matter the order of the --include and
--exclude statements.
I also tried to mess with --include-regexp, but e.g. this:
rdiff-backup --terminal-verbosity 5 \
--include-regexp "/tmp/from/[^\.].+" \
--exclude / \
/ ./to
leads to no files included at all ...
Am 09.01.23 um 07:16 schrieb Eric Zolf:
Hi Tobias,
what about something like:
mkdir /tmp/from
touch /tmp/from/.{un,}wanted /tmp/from/also{un,}wanted
rdiff-backup -v5 backup \
--include /tmp/from/.wanted --exclude /tmp/from/.\* \
--include /tmp/from/alsowanted --exclude /tmp/from/\* \
/tmp/from /tmp/bak
(and /tmp/bak contains then only the wanted files)
So first the includes, then the corresponding excludes. It shouldn't
make a difference if from the command line using --include/exclude or
using files with --include/exclude-globbing-filelist
Hope this helps,
Eric
On 08/01/2023 23:32, Tobias Leupold wrote:
Dear list,
I use rdiff-backup to do automated backups on my server. I backup /,
but I
exclude everything and only include what I need. E.g. I use the
following call
rdiff-backup --include-globbing-filelist /etc/backup.include \
--exclude / \
/ /backup/data
and specify a list of folders I want in /etc/backup.include, e.g.
/etc/crontab
/etc/postfix
/etc/dovecot
/usr/local/bin
/usr/local/sbin
/srv
That works just fine.
Now I'm trying to adapt this to a machine with similar requirements,
but
including some parts of a home directory.
What I can't get to work is: I want to include the home directory,
but
without
all the .whatever files. But I want SOME of them.
E.g. I want:
/etc/some/config_file
/etc/some/other/config_file
And also all the "normal" files and folders in /home/my_user
/home/my_user/folder_1
/home/my_user/folder_2
/home/my_user/foo
/home/my_user/bar
and so on, but I don't want
/home/my_user/.*
but I DO want a defined set of dotfiles, e.g.
/home/my_user/.ssh
/home/my_user/.local/share/foo
I can't get this to work. I played around a lot with
--include-globbing-
filelist, --exclude-globbing-filelist, --include and --exclude, but
either, I
get none of the .whatever files inside /home/my_user, or I get all of
them.
Is it possible to do this? Thanks in advance for all help!
Cheers, Tobias