Skip to content
Advertisement

How to copy files and folders from one remote server to another remote server using scp command? [closed]

I’m using Ubuntu Linux 12.04 LTS on my machine.

There are two remote servers viz.

  • 64.211.219.95
  • 42.11.37.153

I can log in to both servers using ssh command. Both the servers have username root.

Now I want to copy all the files and folders present in folder ‘/var/www/’ from server 64.211.219.95 to the folder ‘/var/www/project_dir/’ on server ‘42.11.37.153’ remotely i.e. using scp command.

How should I do it? What should be the exact command without any syntactical error I’ve to use to make this operation working?

Please somebody help me.

Thanks in advance.

Advertisement

Answer

I presume that your problem is with specifying a wildcard. You can avoid this difficulty using a recursive copy from a directory with a trailing slash, vis:

scp -r root@64.211.219.95:/var/www/ root@42.11.37.153:/var/www/project_dir

The scp command can be run from any server you like, not restricted to the source or destination machine.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement