Syncing from two sources to one target and deleting files not in either source

@lbutlr kremels at
Tue Jul 21 11:14:38 UTC 2020

Given three servers where Server 1 has several GB of files and Server 2 has several GB of files and Server 3 has all the files from both Server 1 and Server 2 in a single directory, how can I remove files on Server 3 that do not exist on either Server 1 or Server 2?

For example, it's say Server1:/home/user1 and Server2:home/user1 have rsync jobs that sync to Server3:/backups/users/user1 and most of the files exist on both server1 and server2, then server3 contains the newest version of each file, but it also contains files that do not exist on either of Server1 nd Server2. This means that if Server1 needs to restore /home/user1/folder it will not only get all the files that should be in folder on Server2, but also all the files that USED to be in folder on either server1 or server2.

I suspect the answer to this is "this isn't a task for rsync" and if so, what might it be a task for?

"Are you pondering what I'm pondering?"
"Wuh, I think so, Brain, but how will we get three pink flamingos
	into one pair of Capri pants?"

More information about the rsync mailing list