HostOnNet Blog

Copying files with rsync

Looking for Linux Server Admin or WordPress Expert? We can help.

rsync is used to sync/copy files. If files are already present on destination, it will not copy files again, only changed or new files get copied when you run rsync.

To Copy files on same computer

rsync -a /path/to/source/ /path/to/destination/

To copy files from one server to another, run

rsync -avz --progress "-e ssh -p 3333" /home/solusvm/ [email protected]:/home/solusvm/

Copying files from remote server to local

rsync -chavzP --stats [email protected]:/home/flashwebhost/Desktop/www/ /home/suneesh/www/

Rsync with exclude option

rsync -avz --delete  "-e ssh -p 3333" --exclude={dn,backup,delete} /home/ [email protected]:/backup/s12/home/

In the above example, folders dn, backup and delete will be ignored.

here is an example that exclude single folder, you can use multiple exclude

rsync -avz --progress --human-readable "-e ssh -p 22" --exclude=wp-content/uploads  /home/diarioti/public_html/ [email protected]:/home/diarioti/public_html/

Posted in Linux

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.