sftp_delete: Delete files in an SFTP account

View source: R/sftp.R

sftp_deleteR Documentation

Delete files in an SFTP account

Description

Specify a file name or a vector of file names to delete in an SFTP account.

Usage

sftp_delete(
  file,
  sftp_connection = get("sftp_con"),
  verbose = TRUE,
  curlPerformVerbose = FALSE
)

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.

Value

The function returns the number of files deleted.

Author(s)

Theodor Stenevang Klemming

See Also

sftp_download, sftp_upload, sftp_rename

Other sftp: sftp_changedir(), sftp_connect(), sftp_download(), sftp_listdirs(), sftp_listfiles(), sftp_list(), sftp_makedir(), sftp_removedir(), sftp_rename(), sftp_upload()

Examples


## Not run: 
# 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)

## End(Not run)


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.