Sunday, August 24, 2008

Copying huge files to/from remote servers.

If you want to copy huge file (in Gigabytes) to remote servers you can not afford to let the connection break. But it happens all the time specially when you are using vpn.

If you have ssh access to the remote machine then you can use rsync over ssh channel to copy files. This approach is better than using scp because rsync has "resume" feature that restarts the copying from where is was aborted.
The syntax is like this:
If you want to copy from local machine to remote machine:
rsync -av -e ssh source_path username@remotemachine:/destination_path

If you want to copy from remote machine to local machine:
rsync -av -e ssh username@remotemachine:/source_path destination_path
(Please note that the above written commands are all on one line)

No comments: