I am using rsync to backup some large files regularly:

rsync --archive --update --append-verify [source] [destination]

Most of the times, the files increase in size (like a log file), but sometimes they are "reset" to empty, from which point they start growing again.

Now, the problem is, with either --append or --append-verify, the files that have been reset will be completely ignored/skipped, according to the rsync man page:

"If a file needs to be transferred and its size on the receiver is the same or longer than the size on the sender, the file is skipped."

I would like to achieve the following rsync behavior:

  1. REPLACE if the source file is smaller than the destination file, otherwise
  2. VERIFY that the destination file matches the first part of source file. If not, REPLACE the destination file
  3. APPEND if the source file is bigger than the destination file

Is this possible?

  • 1
    I assume you are aware that this method (with verification) will be extremely slow, possibly even slower than just copying over the files from scratch each time? – Chris Down Oct 14 '13 at 8:22
  • @ChrisDown, no, I did not know that. Thanks for pointing it out. – W3Coder Oct 17 '13 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.