sftp_delete: Delete files in an SFTP account

Description Usage Arguments Value See Also Examples

View source: R/sftp_functions.R

Description

Specify a file name or a vector of file names to delete in an SFTP account. sftp_delete internally calls RCurl::curlPerform Questions? https://github.com/stenevang/sftp

Usage

1
2
3
4
5
6
7
sftp_delete(
  file,
  sftp_connection = sftp_con,
  verbose = TRUE,
  curlPerformVerbose = FALSE,
  curl_options = list()
)

Arguments

file

A vector of one or more file names that exist on the SFTP url. Wildcard is not supported in order to minimize the risk of accidental deletion. When a large portion of the files currently on the SFTP url needs to be deleted, you can create an input value for file by using sftp_listfiles. Note! Folders (directories) cannot be deleted. See instead sftp_removedir

sftp_connection

A list object created by calling sftp_connect. Default is 'sftp_con'.

verbose

Logical. Turn on messages to console. Default is TRUE

curlPerformVerbose

Logical. Turn on messages to console form curlPerform. Default is FALSE.

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_delete. Optional. Default is an empty list.

Value

The function returns the number of files deleted.

See Also

sftp_download, sftp_upload, sftp_rename, sftp

Examples

1
2
3
4
5
6
7
8
# minimal - delete single file and rely on defaults
sftp_delete("my_bad_file.csv")

# explicit - delete several files in a vector
sftp_delete(file = files$name,
            sftp_connection = sftp_con,
            verbose = TRUE,
            curlPerformVerbose = FALSE)

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