transmit: Transmit files from a remote FTP server

Description Usage Arguments Value Note Examples

View source: R/transmit.R

Description

Utility function that supports easy file matching and download from a remote FTP server. Also enables on-the-fly file renaming and compression.

Usage

1
2
3
4
5
6
7
8
transmit(
  remoteDir,
  localDir = ".",
  pattern,
  rename = NULL,
  compress = FALSE,
  download = TRUE
)

Arguments

remoteDir

character(1). Remote FTP directory path.

localDir

character(1). Directory where to save files locally.

pattern

character(1). Pattern to use for matching.

rename

character(1) or NULL. Rename the local files (including suffix), if desired.

compress

logical(1). Compress the downloaded files.

download

logical(1). Download files (default) or only return the matching URL(s).

Value

Invisible character. Local file paths.

Note

Updated 2021-02-02.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
try({
    remoteDir <- "ftp://ftp.ncbi.nlm.nih.gov/genomes/"
    readme <- transmit(
        remoteDir = remoteDir,
        localDir = tempdir(),
        pattern = "^README\\.txt$",
        rename = "ncbi-readme.txt",
        compress = FALSE
    )
    basename(readme)
    file.exists(readme)
    unlink(readme)
})

acidgenomics/pipette documentation built on Sept. 27, 2021, 9:10 a.m.