sftp_upload: Upload files to an SFTP account

Description Usage Arguments Value See Also Examples

View source: R/sftp_functions.R

Description

This function is used for uploading files to an SFTP account. The function uses connection credentials from a list object created by calling sftp_connect. The files will be uploaded to the SFTP account folder where you are currently "standing" as specified in the connection list object. sftp_upload internally calls RCurl::ftpUpload Questions? https://github.com/stenevang/sftp

Usage

1
2
3
4
5
6
7
8
sftp_upload(
  file,
  fromfolder = getwd(),
  sftp_connection = sftp_con,
  log_file = NA,
  verbose = TRUE,
  curl_options = list()
)

Arguments

file

A character vector of file names. If the wildcard "*" is used, then all files in fromfolder will be uploaded. NOTE! Names of folders (directories) cannot be part of file. To create folders on the SFTP server, please see sftp_makedir

fromfolder

A string containing a valid path - relative or absolute - to the folder where the files in file can be found. Default is the working directory.

sftp_connection

A list object created with link{sftp_connect}. Default is sftp_con.

log_file

Valid path to a text file (.txt, .csv, .log etc) including filename and file extension.

verbose

Logical. Turn on messages to console. Default is TRUE.

curl_options

A list of named values with names as listed by RCurl::listCurlOptions. The values are handed to the .opts parameter of the RCurl function called by sftp_upload. Optional. Default is an empty list.

Value

The function returns the number of files uploaded, following successful upload.

See Also

sftp_download, sftp_delete, sftp_rename, sftp

Examples

1
2
3
4
5
6
7
8
# minimal - upload all files in the current working directory
sftp_upload("*")

# take a vector of file names from a dataframe
sftp_upload(file = files$name, fromfolder = "my/relative/path/")

# take one specific file name from a vector from a dataframe
sftp_upload(file = files$name[1], fromfolder = getwd())

stenevang/sftp documentation built on Feb. 8, 2022, 6:40 p.m.