how to efficiently sync files moved between multiple sources?

Elliot Wilen ewilen at
Wed May 26 01:52:12 MDT 2010

I have two subdirectories, /Work/A and /Work/B. I'd like to sync those two subdirectories (and everything under them, but nothing else) to a remote system. The thing is that when a file is moved from somewhere in /Work/A to somewhere in /Work/B I'd like rsync to just move the file on the remote system rather than deleting and recopying it. Note that I'm using rsync 3.0.7 so I have to be careful about how incremental recursion interacts with filters.

I've got a couple ideas, but I'd appreciate a once-over by more experienced eyes.

Option 1: rsync -azH --delete --include=/A --include=/B --exclude=/* host::Work/ /Work

Option 2: rsync -azH --delete host::Work/A host::Work/B /Work

Thanks in advance.

--Elliot Wilen

More information about the rsync mailing list