I have a cron job that uses rsync to periodically transfer all files that appear in a specific directory on server A to somewhere on server B. I use --partial and --append-verify as the files are large. I also use the remove-source-files option to deletes the files on server A when they are transferred. As per the man page, rsync only delete the source files after all file transfers have completed on a specific run.
This works fine most of the time, except if the transfer is interrupted partway through due to a network failure, after a few files have already been transferred. On the next run, the program sees some of the files already in the destination and correctly determines they don't need to be re-transferred. However, since they were not part of that transfer run, the files in the source server do not get deleted. Over time they build up.
Is there a way to tell rsync to delete the source files on the subsequent run, if they exist in the destination, or is this something I'll have to solve by writing my own scripts?
--checksumor--size-onlyoptions?