How do rsync show/hide filter rules differ from include/exclude?
I'm working on some intense rsync scripts, and I really want to understand the options at my disposal. In general the man page is the best place for information, with dense and precise prose. One notable omission is the description of the show
and hide
filters. They appear in this table in the FILTER RULES
section:
exclude, - specifies an exclude pattern. include, + specifies an include pattern. merge, . specifies a merge-file to read for more rules. dir-merge, : specifies a per-directory merge-file. hide, H specifies a pattern for hiding files from the transfer. show, S files that match the pattern are not hidden. protect, P specifies a pattern for protecting files from deletion. risk, R files that match the pattern are not protected. clear, ! clears the current include/exclude list (takes no arg)
The only other reference is in the rule modifier description section:
An s is used to indicate that the rule applies to the sending side. When a rule affects the sending side, it prevents files from being trans- ferred. The default is for a rule to affect both sides unless --delete-excluded was specified, in which case default rules become sender-side only. See also the hide (H) and show (S) rules, which are an alternate way to specify sending-side includes/excludes.
That seems to indicate they are the same, but sender-side only. Is that the only difference? What are the implications of that? Does it only affect the way deletes are handled?
I found a useful answer to this question here: http://samba.2283325.n4.nabble.com/exclude-vs-hide-td2509204.html
In short, the main difference is that with exclude, the file does not get sent but the receiver is notified that there is such a file and it shouldn't delete it if one of the delete options is used. On the other hand, when the file is hidden, the sender completely ignores it which means the receiver has no information whatsoever about the existence of the file.
In other words, when you just exclude a file, it is protected, whereas when you hide it, it is not. (Unless you override this behavior with --delete-excluded
.)