One of my favorite features in rsync is using it to ‘move’ files between boxes.
rsync --remove-source-files
removes files from the source once rsync determines that the files exist on the destination. A common use around here:
$ rsync -av --remove-source-files
production-box:/some-system/output-files/
/big-storage-device/archives/some-system/$(date +%Y-%m-%d)/
You can also use an undocumented flag which does almost exactly the same thing.
rsync --remove-sent-files
same as –remove-source-files, except that it leaves behind any files for which no update was necessary on the destination side (including metadata if you are using a flag like -a).
The difference is subtle, and you probably usually want –remove-source-files. However, if you expect to always move to a clean location, remove-sent-files leaving behind something can act as a canary, telling you something is not as you expected. It’s may be too late for that day’s data, but at least you know something wacky is going on for the next day. It’s helped me once, so I default to it in most cases.