3

I'm trying to tell rsync to ONLY include .org (or better yet, .org AND .py files). However, I have to do this through the --exclude= option, not the --include= option.

Reason: I'm using BackInTime and want to make a backup config that only include Org and Py files. That interface lets me specify exclusion options, but not inclusion options.

Is there a way to exclude everything but one (or two) specific extensions?

mankoff
  • 275
  • 1
  • 8
  • 2
    Germar says, in reply to [your issue #929 on GitHub](https://github.com/bit-team/backintime/issues/929), to craft a regular expression as an exclusion pattern. However, it is unclear whether BIT actually supports regular expressions in exclude patterns since the examples [in the documentation](https://backintime.readthedocs.io/en/latest/settings.html#exclude) use filename globbing patterns, and the other `man` manuals are not clear on this. – Kusalananda Sep 16 '18 at 07:19
  • I don't think it is a question of BIT supporting it, but rsync supporting it. – mankoff Sep 16 '18 at 08:10

1 Answers1

2

BackInTime has an option to pass any parameters to rsync that you want. In this case you could use --include and --exclude directly (or even --filter).

See the Expert Options pane, last option.

roaima
  • 107,089
  • 14
  • 139
  • 261
  • It's still not trivial to craft the correct combination of options to `rsync`... – Kusalananda Sep 16 '18 at 07:59
  • Thank you for this hint! But I don't think it solves the issue. I can craft a valid rsync command that works: `rsync -r --include="*/" --include="*.org" --include="*.py" --exclude="~/tmp/BACKUP" --exclude="*" --prune-empty-dirs ~/tmp ~/tmp/BACKUP` However, passing even part of this to `rsync` via the BIT UI doesn't work. When using `ps` to examine the `rsync` command BIT generate, it is passing so many other options to `rsync` (and options are order-dependent) that it does not work. – mankoff Sep 16 '18 at 08:08
  • 1
    Actually, the `filter` rule works! Or almost. When I add this to Expert Options `--filter="+ *.org" --filter="+ *.py" --filter="- *.*" --prune-empty-dirs` then it works well enough. It includes files WITHOUT extensions also (because the exclude filter is `*.*`). If I make the exclude filter `*`, then everything is excluded. – mankoff Sep 16 '18 at 08:45
  • This works: `--filter="+ *.py" --filter="+ *.org" --filter="-! */" --prune-empty-dirs` – mankoff Sep 16 '18 at 09:36
  • @Kusalanander I'd say that's true for any moderately complex combination of filter rules, and not particularly something specific to BIT. – roaima Sep 16 '18 at 11:35