Include Exclude .. a canonical way

Wayne Davison wayned at samba.org
Wed Feb 22 19:24:47 GMT 2006


On Wed, Feb 22, 2006 at 05:14:29AM -0600, Harry Putnam wrote:
> Still it seems there would be a more succinct way...

There is if you use rsync 2.6.7 (currently in release testing):

    rsync -avO --prune-empty-dirs --include=bookmarks.xml 
	      --filter='-! */' ~/.kde* some:dest/

This tells rsync to descend through all the ~/.kde* directories that
exist on the sender side and look for one or more bookmarks.xml files.
The --prune-empty-dirs option is new, and ensures that you only create
the directories necessary to hold the bookmarks.xml files.  Notes: the
filter option means "exclude everything that is not a directory", and
the -O option avoids changing the modify-time on the directories.

..wayne..


More information about the rsync mailing list