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?