I was wondering whether scp
like:
scp localmachine/path_to_the_file username@server_ip:/path_to_remote_directory
is possible using R code? In other words, for copy a file in local machine in R, one could use file.copy
, what are the R possibilities to copy file from local machine to a remote machine?
there is package ssh.utils which wraps ssh commands in R functions.
So your example would become:
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")
EDIT: I could install it but anyway it's not very flexible as it does not accept options...
With a system command this would be just:
system("scp localmachine/path_to_the_file username@server_ip:/path_to_remote_directory")