$ rsync -avz --delete-after /home/pong/rsyncsource /home/pong/rsyncdest


a : Recursively transfer all files from the directory hone/pong/rsyncsource on the machine foo into the /home/pong/rsyncdest/rsyncsource directory

The files are transferred in “archive” mode, which ensures that symbolic links, devices, attributes, permissions, ownerships etc are preserved in the transfer.

v : verbose
z : compression will be used to reduce the size of data portions of the transfer.

–delete-after : delete the files that got deleted on rsyncsource on rsyncdest after transfer ( ref : )

–rsh=”ssh …” : choose an alternative remote shell program to use for communication between the local and remote copies of rsync. Typically, rsync is configured to use ssh by default. However, if you would like to change an ssh encryption or change port ( ssh -p 2234 ), or change an identity file ( ssh -i /path/to/id_rsa ).

Rsync with last modified date

  • Last modified date is one of the factor that rsync use to decide to copy, if we use cp before rsync and we would like to preserve the last modified date, use the –preserve flag.

cp –preserve

Therefore, I use -c ( checksum ) instead.

NOTE : -c ( checksum ) won’t works with -a ( that alias contains -t that is checking last modified date.






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s