【问题标题】:How to do scp in R? [closed]如何在 R 中执行 scp? [关闭]
【发布时间】:2018-04-30 03:03:19
【问题描述】:

我想知道scp 是否喜欢:

scp localmachine/path_to_the_file username@server_ip:/path_to_remote_directory

可以使用 R 代码吗?换句话说,要在 R 中复制本地机器中的文件,可以使用file.copy,R 将文件从本地机器复制到远程机器的可能性是什么?

【问题讨论】:

  • 您可以随时使用system 拨打scp 电话
  • @Dason,你能写一个示例命令吗?
  • system("that thing you wrote goes here")

标签: r linux ssh copy scp


【解决方案1】:

有一个包 ssh.utils 将 ssh 命令包装在 R 函数中。

所以你的例子会变成:

library(ssh.utils)
cp.remote(remote.src = "", 
          remote.dest = "username@server_ip", 
          path.src = "localmachine/path_to_the_file",
          path.dest = "path_to_remote_directory")

编辑:我可以安装它,但无论如何它不是很灵活,因为它不接受选项...

使用系统命令,这将是:

system("scp localmachine/path_to_the_file username@server_ip:/path_to_remote_directory")

【讨论】:

  • Warning in install.packages : package ‘ssh.utils’ is not available (for R version 3.4.1)
猜你喜欢
  • 2018-10-03
  • 2012-11-07
  • 1970-01-01
  • 2013-02-08
  • 2021-03-26
  • 1970-01-01
  • 1970-01-01
  • 2010-10-13
  • 2015-10-20
相关资源
最近更新 更多