sftp_removedir: Remove a new directory in an SFTP account

Description Usage Arguments Value See Also Examples

View source: R/sftp_functions.R

Description

Remove one or several directories (subdirectories) in an SFTP account. The function uses connection credentials from a list object created by calling sftp_connect. sftp_removedir internally calls RCurl::curlPerform Questions? https://github.com/stenevang/sftp

Usage

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

Arguments

foldername

A character vector of length 1 or more, containing the names of folders you want to remove. The folder(s) will be looked for below the folder where you are currently standing according to the sftp connection list object you are using (default 'stfp_con'). A subfolder or a subsubfolder etc can be removed in one single operation by supplying a path, like "folder1/folder2/folder3". That will remove the last folder in the path, in this case "folder3". NOTE! Non-empty directories cannot be removed.

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

Value

The function returns the number folders deleted.

See Also

sftp_makedir, sftp_rename, sftp_changedir, sftp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# minimal - remove one folder, rely on defaults
sftp_removedir("this_folder_is_bad")

# explicit - remove a directory at the end of a multi-level path
sftp_removedir(foldername = "level1/folder2/directory3",
             sftp_connection = sftp_con,
             verbose = TRUE,
             curlPerformVerbose = FALSE)

# remove several folders as specified in a vector of names
sftp_removedir(removefolders$names)

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