[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to exclude all dotfiles in a folder but include a specific set?
From: |
Tobias Leupold |
Subject: |
Re: How to exclude all dotfiles in a folder but include a specific set? |
Date: |
Mon, 09 Jan 2023 12:42:10 +0100 |
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
- How to exclude all dotfiles in a folder but include a specific set?, Tobias Leupold, 2023/01/08
- Re: How to exclude all dotfiles in a folder but include a specific set?, Eric Zolf, 2023/01/09
- Re: How to exclude all dotfiles in a folder but include a specific set?, Tobias Leupold, 2023/01/09
- Re: How to exclude all dotfiles in a folder but include a specific set?,
Tobias Leupold <=
- Re: How to exclude all dotfiles in a folder but include a specific set?, EricZolf, 2023/01/09
- Re: How to exclude all dotfiles in a folder but include a specific set?, qx6uwumzvv, 2023/01/10
- Re: How to exclude all dotfiles in a folder but include a specific set?, Patrik Dufresne, 2023/01/10
- Re: How to exclude all dotfiles in a folder but include a specific set?, EricZolf, 2023/01/10
- Re: How to exclude all dotfiles in a folder but include a specific set?, Reio Remma, 2023/01/10
- Re: How to exclude all dotfiles in a folder but include a specific set?, qx6uwumzvv, 2023/01/10