download.files: Try to download one or more files

View source: R/download.files.R

download.filesR Documentation

Try to download one or more files

Description

Attempts to download files, given name(s) all from one specified url, saving them in specified folder. Just a wrapper that Uses download.file() since that only downloads a single file.

Usage

download.files(
  url,
  files,
  destfiles,
  todir,
  silent = FALSE,
  overwrite = FALSE,
  ...
)

Arguments

url

The url of folder with files to download, as character string, or a vector: If files is specified, url should be the one folder without the filename. Otherwise, a vector of full paths with filenames.

files

Optional. A character vector of file names to be found at url. If missing, assumes url is full path including filename.

destfiles

Optional. A character vector of one or more file names. If missing, it uses same names as in files at url.

todir

The folder where downloaded files will be placed, as a character string.

silent

Logical, optional, FALSE by default. Prints a message using cat() if TRUE.

overwrite

Optional, logical, FALSE by default. If FALSE, checks to see if file already exists in local folder and does not download if already exists. But note that may cause problems if zero size file exists already due to earlier failed download.

...

optional parameters passed to utils::download.file

Value

Returns vector of numbers, each being 1 or 0 or 2 to signify success or failure or no attempt because file already seems to exist locally.

Note

Could recode to use the curl package, since curl::curl_download() is a replacement for base download.file() with better performance, support for encryption (https, ftps), gzip compression, authentication, etc.

See Also

utils::download.file() curl::curl_download()


ejanalysis/analyze.stuff documentation built on April 2, 2024, 10:10 a.m.