The rsync man page boggles my mind in similar ways to the rrdtool man page. So let’s say you want to use rsync to pull files from location A/sender to a specific location B/receiver and then clean up location A/sender. See the files are on location B/receiver after the sync, so there’s no sense in having them on location A/sender anymore, right?
You’d think to yourself, “…well, I just want to delete the files…dummy.” And then you’d look at the rsync man page:
This tells rsync to delete extraneous files from the receiving side (ones that
aren't on the sending side), but only for the directories that are being
Wait, that kills files on location B/receiver … what if I want to kill them on location A/sender after the sync?
In this case, if you look just a line above the –delete section you’ll see a section called –remove-source-files that reads:
This tells rsync to remove from the sending side the files (meaning non-directories)
that are a part of the transfer and have been successfully duplicated on the receiving
So now with this directive you craft a command that looks something like:
1. Pull files from Location A (Sender) to Location B (Receiver)
2. Verify files on Location B (Receiver) are really Location A (Sender) files
3. Clean up Location A (Sender)
This actually only exists in later versions of rsync (> 2.6.8), Sean Reifschneider from Tummy blogged about it awhiles back. Your mileage might vary, so be careful when playing … but handy.