Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 使用scp命令复制文件/文件夹_Linux_Windows_Shell_File Transfer_Scp - Fatal编程技术网

Linux 使用scp命令复制文件/文件夹

Linux 使用scp命令复制文件/文件夹,linux,windows,shell,file-transfer,scp,Linux,Windows,Shell,File Transfer,Scp,如何将文件/文件夹从windows复制到linux(putty),可能使用scp命令 我用的是scpuser@hostname(windows):c:\folder\filnameuser@hostname(Linux):/folder/filename(destination),但不幸的是,我遇到了一个错误 基本上,我正在尝试从windows复制到Linux。希望无论我是在windows还是Linux上,它都能工作。如果您想使用scp将文件从windows复制到Linux,您必须使用Winsc

如何将文件/文件夹从windows复制到linux(putty),可能使用scp命令

我用的是scpuser@hostname(windows):c:\folder\filnameuser@hostname(Linux):/folder/filename(destination),但不幸的是,我遇到了一个错误


基本上,我正在尝试从windows复制到Linux。希望无论我是在windows还是Linux上,它都能工作。

如果您想使用scp将文件从windows复制到Linux,您必须使用Winscp。此链接将非常有用

谢谢和问候,

Alok Thaker

我不认为这种形式可以用反斜杠
\
分隔符:

scp user@hotname:c:\folder\filname user@hostname:\folder\filename(destination)
首先,Linux中的路径分隔符是
/
,而不是
\
,因此这会更好:

scp user@hotname:c:\folder\filname user@hostname:/folder/filename
scp c:\folder\filname user@hostname:/folder/filename
其次,您的命令看起来像是在第三台PC上运行此命令,即在machineC上,将文件从machineA复制到machineB。如果情况并非如此,并且您实际上正在使用machineA将文件复制到machineB,那么这样做会更好:

scp user@hotname:c:\folder\filname user@hostname:/folder/filename
scp c:\folder\filname user@hostname:/folder/filename
更新

如果您在Windows中没有
scp
命令,以下是一些选项:

  • 安装。即使您不使用Git,这个安装程序也包括一个优秀的终端和常用的*nix命令,以及
    scp
  • 下载。您可以使用
    pscp.exe
    而不是
    scp
    ,以上语法将起作用
  • 安装。它有,但是如果您想使用命令行,前两个选项更容易

在*nix系统中,这应该可以工作:

# to copy file.ext from remote server to current working directory
# note the dot (.) at the end, which means current directory
$ scp user@remote.server.com:~/desired/folder/file.ext .

# to copy all files in a folder from remote server 
#                                to current directory
# note the dot (.) at the end, which means current directory
$ scp -r user@remote.server.com:~/desired/folder/* .


# copy a folder and all its contents as it is from remote server 
#                                              to current directory
# note the dot (.) at the end, which means current directory
$ scp -r user@remote.server.com:~/dersired/folder .

更多信息也可以在本文中找到:

如果我从windows执行操作,则“scp”不会被识别为内部或外部命令、可操作程序或批处理文件。如果我从Linux到我的windows计算机,那么我会得到“ssh:连接到主机端口22:连接拒绝断开连接”我想我必须使用Winscp。@knm我更新了我的帖子,添加了一些选项以获得
scp