Transferring Files From and To a Remote Server Using rsync

Transferring Files From and To a Remote Server Using rsync

 

Here are a few useful commands that you could use when transferring files from one server to another.

From source server to destination:

  • With a default SSH port:

 rsync -vHaxx user@your-remote-server.com:/home/user/dir/
  • With a special SSH port:

rsync -avz -e 'ssh -p 2510' user@your-remote-server.com:/home/user/dir/

 


Reverse rsync, syncing files form a remote server to local.

  • With a default SSH port:

rsync -vHaxx your-user@your-remote-server.com:/home/user/dir/ /home/user/local-dir/
  • With a special SSH port:

rsync -avz -e 'ssh -p 2510' your-user@your-remote-server.com:/home/user/dir/ /home/user/local-dir/

Also if you would like to transfer only the missing files you could use the --ignore-existing flag. This is very useful for final sync in order to ensure that there are no missing files after a website or a server migration.

Basically the commands would be the same apart from the appended --ignore-existing flag.

From source server to destination:

  • With a default SSH port:

 rsync -vHaxx --ignore-existing  user@your-remote-server.com:/home/user/dir/
  • With a special SSH port:

rsync -avz -e 'ssh -p 2510' --ignore-existing user@your-remote-server.com:/home/user/dir/

 


Reverse rsync, syncing files form a remote server to local.

  • With a default SSH port:

rsync -vHaxx --ignore-existing your-user@your-remote-server.com:/home/user/dir/ /home/user/local-dir/
  • With a special SSH port:

rsync -avz -e 'ssh -p 2510' --ignore-existing your-user@your-remote-server.com:/home/user/dir/ /home/user/local-dir/

Hope that this helps.

Coffee For Me
Recent Posts
Proxies Demystified
Proxies Demystified
2019-11-05 09:31:05