You Are Using rsync Incorrectly And You Will Lose Everything Unless You Read This Now!

rsync is generous in its functionality and flexible in how you use it. The only bad things it can do are what you tell it. The most important thing that you need to know immediately about rsync is that you can get a preview of what you are telling it to do before it actually does it. Here is how

  • First: Read the man page three times.
    • Read one: You will feel a little overwhelmed
    • Read two: You will feel OK
    • Read three: You will feel good about rsync
  • Second: Create a shell script in bash and paste in the contents below, customizing it with your source and destination.

    #!/usr/local/bin/bash

    rsync -vv \
    –archive \
    –delete \
    –compress \
    –itemize-changes \
    –human-readable \
    –partial \
    –progress \
    $1 \
    SOURCE \
    DESTINATION

    This is a simple call that mirrors a directory, handles interrupted transfers and lets you re-start again, and keeps you informed of just about every single thing that it is doing.

  • Third: call rsync but tell it only to preview it’s work, not actually do it. This is called a dry run. It lets you inspect changes, but it doesn’t do them. That is pretty important when it can delete things on either end. At best, it saves you some time having to re-push everything. You can initiate a dry-run by passing the parameter to rsync as an argument to this script.

    ./siwput.sh –dry-run

When you omit this argument, the call will execute and do the work for real.

There you have it. This will help you have a pretty good day using rsync.

Leave a Reply

Your email address will not be published. Required fields are marked *