I want to be able to sync files from multiple directories to one directory. If I remove a directory from the source list, then I want that directory and all of its files to be removed from the destination.
Here's a quick sample:
mkdir dir1 touch dir1/file1 mkdir dir2 touch dir2/file2 mkdir dir3 rsync -a dir1 dir2 dir3 dir3 now contains "dir1/file1" and "dir2/file2".
If I rsync again, and remove dir2 from the list:
rsync -a dir1 dir3 Then I would like dir2/file2 and dir2 to be removed from the destination.
The --delete option to rsync only handles deletes between dir1 and dir3/dir1, so dir2 remains (even if using --delete).
I've looked through the various option in the man page for rsync, and I don't see any option that tells rsync to "combine" all the sources and consider them as "one" tree so that "--delete" would do what I want it to do. However, I'm pretty confident I'm not the first person to want to do something like this.
Ideas?
rsyncdoesn't "know" aboutdir2, so it won't delete it.