12

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?

0

1 Answer 1

16

I found a useful answer to this question by Michal Soltys here: https://lists.samba.org/archive/rsync/2008-November/022027.html

Matthew Monaco wrote:

What is the difference between exclude and hide in the filter rules?

Normally, 'hide' is interpreted only by the sender and the files will never show up in the file list sent to the receiver. 'Exclude' is both 'hide' (sender) and 'protect' (receiver) - so files that will not show up in the file list, will not be deleted by the receiver (if you use any of the available delete options). With separate 'P' and 'H', as well as 'S' and 'R' (respectively - sender and receiver's 'include') you can create quite clever rules.

When 'hide' is used in rsyncd.conf filters with rsync in daemon mode, it may work a bit differently. When rsync daemon operates as a sender 'hide' will function as usual, but when it operates as a receiver - it will also be interpreted (normally receiver wouldn't) and will not allow any updates to files matching the wildcard used. The same goes for 'protect' and 'exclude'. So in short - functionality is extended from 'don't delete' to 'don't update or delete'.

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.)

2
  • broken link, please update
    – TJR
    Nov 13, 2023 at 18:30
  • Since this written over 10 years ago, I cannot recall exactly what the original link was pointing to, but I found a message with the same subject in a different archive of the same mailing list, which seems relevant. I'm assuming it's the same message, but can't confirm it myself. Take it for what it is.
    – koniiiik
    Nov 15, 2023 at 12:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .