June 10, 2007 – 3:59pm Rsync to the rescue: Copying files from server to server

We recently had to move a client’s web site to a new host. There is about 600 MB of images, video clips, and other files that we needed to transfer between hosts. Rather than FTP the files down from the old host and then re-copy them up to the new host, we used rsync to copy the files directly between the two hosts. To do this, you need shell access to both servers.

Login to the new host. Then at the shell prompt use the following command:

 rsync -avc -e ssh [user]@[oldhost]:[path] [new path]

The -avc flags are for archive mode (recursive), verbose, and checksum. -e is to specify the remote shell.

Posted in  Web Development   |  delicious  Digg

2 Responses to “Rsync to the rescue: Copying files from server to server”

  1. another good tip: do a dry run before actually copying with the -n flag, and exclude unnecessary files with –exclude-file:

    rsync -avcn -e ssh xxx@xx.xx.xxx:/your/old/path/ your/new/path –exclude-from rsync_exclude.txt

    By smeves on Jun 21, 2007

  2. if you want to connect to ssh with a different port, use: -e ’ssh -p####’

    By Scott Meves on May 24, 2008

Post a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word