How to rsync files from one server or directory to another

Moving files can be a tedious job for some projects and there are many different ways to move files.

  • You can take the easy way – FTP or sFTP (secure FTP) the files down to your local computer, then upload them to the new location.
  • You can create an archive of the files you want to move on the source server, then SSH into your target server and do a wget command.

    e.g. wget http://www.some-server-somewhere.com/[filename]. Then you would un-pack those files into the destination directory or put them in a working directory and move them from there.

  • You can rsync the files between to servers of directories: This puts them in the exact location you want and can only move files that are new since last rsync or are new between old and new locations.e.g.

    rsync -avHPe “ssh -p[port#” root@[hostname]:/home/username/public_html /home/username/

You can also use SCP (secure copy) – which is SSH-based and uses a format like so:

 

scp path-to-source path-to-destination

Want to discuss a project?

  • This field is for validation purposes and should be left unchanged.