Re: How to exclude all dotfiles in a folder but include a specific set?
Eric Zolf <[email protected]> Mon, 9 Jan 2023 07:16:06 +0100
| Newsgroups | gmane.comp.sysutils.backup.rdiff-backup.general |
|---|---|
| Organization | Rdiff-Backup.net |
| Message-ID | <[email protected]> |
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
>
>
>