--include vs. --exclude

Wayne Davison wayned at samba.org
Sat Apr 3 19:41:45 GMT 2004

On Sat, Apr 03, 2004 at 01:04:25PM -0600, Phil Howard wrote:
> I was not including that first --include '*/' for the directories.
> I was under the impression rsync simply created directories "as needed".

It does create directories "as needed", but that is irrelevant to what
is happening here.  You must specifically include the directories you
want to be visited in the recursive descent through the filesystem or
that directory will never be scanned for files.  This is mentioned
several times in the EXCLUDE PATTERNS section of the manpage.

One thing that could make this simpler is the idea of a "lazy create"
for directories.  With such an option, either the sender would eliminate
directories from the file list that weren't needed, or the receiver
would hold-off on creating directories until a file required one or more
parent directories to exist.  I don't know if I'd actually want to put
such an option into rsync, though.


More information about the rsync mailing list