scp command to copy files from remote to local host returns error
I need to copy/transfer some files between different machines over the same network. After doing some reading and search, I thought trying out Java's jsch
may be a good option. The bitter fact is probably that no good documentation is available for the jsch perhaps. But then there aren't any other options that I know of.
To implement the file transfers, I picked up two machines on the same network, say host1 (server) where in I installed sshd server
, is up and running and I am able to connect to it using putty. Second machine, say host2 (client/local). I installed sshd here as well.
Now I tried copying a file 'test.txt' on desktop of host1 (server) to host2 (client) by running following command in putty after connecting to host1 -
scp admin@host1:test.txt /c
But it returns the following error -
'scp' is not recognized as an internal or external command,
operable program or batch file.
What am I doing wrong? I thought to try in putty first and then implement in java. I am working on jsch/ssh for the first time, so any help would be great.
If you need to scp
something from Windows, then why not simply use pscp
to achieve this?
You can download it from the PuTTy
website.
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
If you want to use it in a Java program, then here is an example: http://www.jcraft.com/jsch/examples/ScpFrom.java.html
You could install git for windows ( http://code.google.com/p/msysgit/ ). Git for windows includes ssh and scp which you can access when using a git bash window.
Then you can use git for source control as well! :-)
locate scp
看看你是否真的拥有它。
链接地址: http://www.djcxy.com/p/92202.html上一篇: 如何将文件从EC2实例下载到本地计算机