Saturday, April 3, 2010

Copying files from one host to another with scp command

Best Reference

Copy entire folder with all files and subfolders
user@user:~$ scp -r /var/www/localdir/ user@

In windows
Putty and pscp are excellent tools for ssh and scp operations in windows os.
Download putty and pscp softwares from
They are self executable files so no need to install those just place in some folder ex: c:\programfiles\putty folder and set the path in command prompt.

open command prompt (DOS Prompt)from start -> run -> cmd

set PATH=C:\path\to\putty\directory;%PATH%

So to copy the file /etc/hosts from the server as user fred to the file c:\temp\example-hosts.txt, you would type:

pscp c:\temp\example-hosts.txt

To send (a) file(s) to a remote server:

pscp [options] source [source...] [user@]host:target

So to copy the local file c:\documents\foo.txt to the server as user fred to the file /tmp/foo you would type:

pscp c:\documents\foo.txt

You can use wildcards to transfer multiple files in either direction, like this:

pscp c:\documents\*.doc
pscp*.c c:\source

Copy entire folder from remote server to local computer along with files and subfolders
pscp -r* c:\source

Ref :