cp_remote {qsub}R Documentation

A wrapper around the scp shell command that handles local/remote files and allows copying between remote hosts via the local machine.

Description

A wrapper around the scp shell command that handles local/remote files and allows copying between remote hosts via the local machine.

Usage

cp_remote(
  remote_src,
  path_src,
  remote_dest,
  path_dest,
  verbose = FALSE,
  recursively = FALSE
)

Arguments

remote_src

Remote machine for the source file in the format user@machine or an empty string for local.

path_src

Path of the source file.

remote_dest

Remote machine for the destination file in the format user@machine or an empty string for local.

path_dest

Path for the source file; can be a directory.

verbose

Prints elapsed time if TRUE

recursively

Copy a directory recursively?

Examples

## Not run: 
## Copy file myfile.csv from the home directory on the remote server to
## the local working directory.

## on remote server in bash shell:
# cat myfile.csv
# [me@myserver ~]$ cat myfile.csv
# "val","ts"
# 1,
# 2,
# 3,
# 4,
# 5,
# 6,
# 7,
# 8,
# 9,
# 10,

## on local server in R:
cp_remote(remote_src = "me@myserver", path_src = "~/myfile.csv",
          remote_dest = FALSE, path_dest = getwd(), verbose = TRUE)
# [1] "Elapsed: 1.672 sec"
df <- read.csv("myfile.csv")
df
#    val ts
# 1    1 NA
# 2    2 NA
# 3    3 NA
# 4    4 NA
# 5    5 NA
# 6    6 NA
# 7    7 NA
# 8    8 NA
# 9    9 NA
# 10  10 NA

## End(Not run)

[Package qsub version 1.1.3 Index]