1

Edit: Ignore this question. Weird bugs happened today.

I am using Timeshift for full system backups. (all Home folders included).

How can I exclude a sub folder of the home folder, like ~/Dropbox from the backup?

I tried

+ /home/nils/**
+ /root/**
- /home/nils/Dropbox/***

and I tried

Edit: This is how to do it. I must have typed something wrong.

- /home/nils/Dropbox/***
+ /home/nils/**
+ /root/**

In both cases, the Dropbox folder, including its contents, gets included in the backup, which I do not want.

Evan Carroll
  • 28,578
  • 45
  • 164
  • 290
Nils Lindemann
  • 208
  • 1
  • 9
  • 1
    There is no "timeshift" tag; [tag:backup] is probably sufficient – roaima May 04 '23 at 19:37
  • 1
    @roaima Since these are `rsync` filters, or so I believe, anyway, maybe the `rsync` tag could possibly be useful. It's a pity the `timeshift` software is so poorly documented. It would be useful to be able to point to an actual reference saying, "look it's handled exactly as in `rsync`", but I've found nothing of the sort. – Kusalananda May 04 '23 at 19:39

1 Answers1

2

On the basis that timeshift uses rsync under the hood, it's important to note that,

  1. the paths in a filter file such as the one you show are relative to the root of the transfer
  2. the include/exclude operations work from the top down with the first match being applied.

If you are transferring from /home/nils then all the paths in the filter file start there - even if they begin with /. On the other hand, if you are using timeshift to backup from / then the paths should be correct.

Note that the first line tells rsync (timeshift) to include everything under /home/nils. Any later pattern under /home/nils - such as /home/nils/Dropbox/ - will never be matched. Change the order to exclude files and directories before you specify a broader set for inclusion.

Consequently you need to reorder your example like this:

- /home/nils/Dropbox/***
+ /home/nils/***
+ /root/**
roaima
  • 107,089
  • 14
  • 139
  • 261
  • I don't know what you want to say here, it for sure does not answer my question. Delete and try again. – Nils Lindemann May 04 '23 at 20:35
  • 1
    @NilsLindemann I have answered your question. I'm sorry to hear that you don't understand it, but please don't be so rude - this is free help. However, I've added a modified filter file for you - perhaps that will enable you to understand – roaima May 04 '23 at 20:56
  • Thank you! That code example did it. Timeshift for some reason duplicates the `+ /home/nils/**` when I append a further star, so I actually have four rules (`/home/nils/**` as last), but, still, with `+ /home/nils/***` in the second row it now finally ignores the `Dropbox` folder. – Nils Lindemann May 04 '23 at 21:24
  • 1
    A line with three stars such as `/home/nils/***` is equivalent to the two rules `/home/nils` and `/home/nils/**` (see `man rsync` and search for `PATTERN RULES`) but I don't see why timeshift should be doubling up any lines itself – roaima May 04 '23 at 21:46
  • Timeshift has `- /home/user/**` and `- /root/**` preconfigured, and one can not get rid of these entries. That is because the Timeshift developers believe that Timeshift should only be used for backing up the system and not user data. I disagree. Regular backing up the whole system with Timeshift is quite handy. Big media files go to the Dropbox folder, which shall get excluded, which has led to this question. Of course, it would have been smart if the timeshift developers had chosen the user-friendly path, which is to allow users to delete these preconfigured entries. – Nils Lindemann May 04 '23 at 22:24
  • According to the [README](https://github.com/linuxmint/timeshift#user-data-is-excluded-by-default) it's perfectly possible to include users' home directories too. It's just that the default setting is to exclude them – roaima May 04 '23 at 23:02
  • Actually, I just tested it again with your above code example, but just two instead of three stars behind the `+ /home/nils/`, and this now also excludes the Dropbox folder. I tested exactly this syntax before, with no pre-existing backups, multiple times. The folder was *not* excluded. Well, whatever. Now it gets excluded, like I expected all the time. – Nils Lindemann May 04 '23 at 23:31