how to mirror only selected directories?

Wayne Davison wayned at
Tue Aug 30 02:36:58 GMT 2005

On Mon, Aug 29, 2005 at 04:41:31PM -0500, Moe, Mark wrote:
> But I can't have that particular side-affect since I'd like to have
> one site be the master for all folders except for "abc" folders and
> the 2nd site be the master for only the "abc" folders in this
> particular tree.

Your only choices are to tell rsync to include all directories (as Aaron
suggested), or to switch over to using --files-from.  No amount of
include fiddling with work around that limitation (see the man page's
description on how the directory traversal is recursive, and telling
rsync to block a directory blocks rsync from ever even looking at any of
the blocked dir's subdirs).

Switching to --files-from could take the output of a find command and
send it all in one go.  E.g.:

find . -name 'abc*' -type dir | rsync -av --files-from=- . host:/dest


More information about the rsync mailing list