Order of precedance (exclude, include)

Asked by Calcipher

I was wondering what the order of precedence is in BiT. In my situation, I want to included specific folders from /media (folders which are always mounted there, I do realize that persistent mounted things should be in /mnt), but exclude /media itself (thus blocking removable drives from getting backups). So, if I make a rule to exclude /media/* and another rule to include /media/example will /media/example be backed up? Also, what would happen if /media/example was not present, but there was a rule to include it?

Question information

Language:
English Edit question
Status:
Solved
For:
Back In Time Edit question
Assignee:
No assignee Edit question
Solved by:
Dan
Solved:
Last query:
Last reply:
Revision history for this message
Dan (danleweb) said :
#1

Normaly exclude rules are are stronger than include.
But why don't you just include "/media/ABC" folder ?

Revision history for this message
Calcipher (calcipher) said :
#2

Well, the reason I don't just include /media/ABC is that I am doing a backup of everything '/' and excluding those things that I do not want backed up. It would seem logical to me to have those files that users have explicitly specified to be backed up take precedence over exclude rules. Perhaps you could morph this into a whishlist item?

Revision history for this message
Calcipher (calcipher) said :
#3

Just to clarify:
My include list (as of right now) is only root ('/') and I'm using the exclude list to block that which I don't want backed up. I'd like to exclude /media (as it might have transient devices) and include only those things in /media that I want (e.g. /media/ABC for backup, /media/randomUSBdevice is skipped).

Revision history for this message
Best Dan (danleweb) said :
#4

I reviewed the code and I was wrong. Include rules came before exclude so if you include "/" + "/media/ABC" and exclude "/media/*" it should work ... but you should try it.

Revision history for this message
Calcipher (calcipher) said :
#5

Thanks Dan, that solved my question.

Revision history for this message
Calcipher (calcipher) said :
#6

I just wanted to confirm that, yes, includes take precedence over excludes. Thank you for the great software!

Revision history for this message
Sparhawk (sparhawkthesecond) said :
#7

I know this is an old thread, but I think this information is still relevant.

I wanted to include `/media/HDD1/foo`, while excluding anything else in `/media`. I also have `/` in the include list.

Firstly, if I have just `/media` in the exclude list, `/media/HDD2` is also backed up. If I stop including `/media/HDD1/foo`, this won't be backed up. It seems that I need to exclude `/media/*` instead.

Similarly, if I have `/media/HDD1` in the exclude list, `/media/HDD1/bar` is backed up. Again, I have to exclude `/media/HDD1/*` instead.

So anyway, it works fine, but users just have to be careful with the syntax, as it's a bit deceptive. (I'm not really sure what difference is expected between `/foo` and `/foo/*`. I instinctively go with the former, since * suggests it doesn't include .*, which is not the case in backintime's implementation. )

Revision history for this message
Germar (germar) said :
#8

Please take a look at 'man rsync' FILTER RULES section. It's quite complex and the manpage explains this lot better than I ever could.

Revision history for this message
Sparhawk (sparhawkthesecond) said :
#9

Hmm, that's so much more complicated that I expected. Thanks for the tip.