Search code examples
rcurlsftp

curl for R delete file on sftp


With library(RCurl) I could remove files from my SFTP like so:

library(RCurl)
curlPerform(
   url = sftp_url,
   quote = "rm file.txt")
)

How could I do the same using library(curl) instead of `library(RCurl)


Solution

  • I managed somehow but not sure whether this is the canonical way:

    library(curl)
    nh <- new_handle(quote = "rm test.txt")
    invisible(curl_fetch_memory(sftp_url, handle = nh))