SCP w/ ssh: copying a local file from windows to a

2019-01-30 17:56发布

So, I'm attempting to simply transfer folder of files from my local computer to a server via ssh and scp. After sudoing I'm using the command as follows:

scp -r C:/desktop/myfolder/deployments/ user@host:/path/to/whereyouwant/thefile

I get the error:

ssh: C: Name or service not known

I'm guessing its my syntax for c:/desktop etc. Any ideas?

BTW I'm using putty + Windows 7.

6条回答
霸刀☆藐视天下
2楼-- · 2019-01-30 18:03

Drive letters can be used in the target like

scp some_file user@host:/c/temp

where c is the drive letter. It's treated like a directory.

Maybe this works on the source, too.

查看更多
虎瘦雄心在
3楼-- · 2019-01-30 18:10

On windows you can use a graphic interface of scp using winSCP. A nice free software that implements SFTP protocol.

查看更多
你好瞎i
4楼-- · 2019-01-30 18:16

If your drive letter is C, you should be able to use

scp -r \desktop\myfolder\deployments\ user@host:/path/to/whereyouwant/thefile

without drive letter and backslashes instead of forward slashes.

You are using putty, so you can use pscp. It is better adapted to Windows.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-01-30 18:16

I have found it easiest to use a graphical interface on windows (I recommend mobaXTerm it has ssh, scp, ftp, remote desktop, and many more) but if you are set on command line I would recommend cd'ing into the directory with the source folder then
scp -r yourFolder username@server:/path/to/dir
the -r indicates recursive to be used on directories

查看更多
可以哭但决不认输i
6楼-- · 2019-01-30 18:16

Drive letter can be used in the source like

scp /c/path/to/file.txt user@server:/dir1/file.txt
查看更多
家丑人穷心不美
7楼-- · 2019-01-30 18:26

You can also try this:

scp -r /cygdrive/c/desktop/myfolder/deployments/ user@host:/path/to/whereyouwant/thefile
查看更多
登录 后发表回答