HostOnNet Blog

Copying files with rsync

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/ root@

Copying files from remote server to local

rsync -chavzP --stats suneesh@ /home/suneesh/www/

Rsync with exclude option

rsync -avz --delete  "-e ssh -p 3333" --exclude={dn,backup,delete} /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/ root@

Posted in Linux