I have an rsync process which is syncing content from a source repository (which is version controlled) into a shared NFS mount.
The scenario (as awful as it is) is that the destination folder contains more content than the source folder because other content is synced to the destination folder from different sources. So for instance, folder structures may look like this:
source
a/a1.txt
a/a2.txt
b/b1.txt
destination
a/a1.txt
a/a2.txt
a/a3.txt
b/b1.txt
c/c1.txt
(in this example, a/a3.txt and c/c1.txt are synced to the destination from elsewhere. In practice this involves multiple other sources and the content/processes for these can’t be influenced.)
Now say that source folder deletes the a/a2.txt file. Using the existing setup, this file would not be deleted on the destination; but using --delete would result in other files being deleted, and it is a requirement to not do this.
How could --delete be used on this rsync but meet the requirement? Because the source directory is version controlled, it is simple enough to get a before-and-after of this directory, so a differential backup could be calculated using the original source directory as a reference, but is this the best way?
--compare-destcould be used for this at all. – cmbuckley May 30 '18 at 11:17--compare-destdoes not affect--deleteso that won't do what you want either. You will need the "before" state of the source, no way around that. If your version control tool can generate a commit diff for the entire directory just make one of those and apply the diff to the destination. – jw013 May 30 '18 at 20:08diffit is! – cmbuckley May 31 '18 at 10:02