Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.


Stack Overflow

The old fashioned way


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 by in  Web Development

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

  1. smeves says:

    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 your/new/path --exclude-from rsync_exclude.txt
  2. Scott Meves says:

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