How can I delete a file from my SFTP server using the {curl} package in R

Hi all,

This is a cross post from How can I delete a file from my SFTP server using the {curl} package in R - Stack Overflow

I am trying to delete a file on an SFTP server using the curl package in R, but I fail

PackageVersion('curl'): # 5.2.0

curl::curl_fetch_memory(
  url = "sftp://username:password@server-ip-address", 
  handle = curl::new_handle() |> 
    curl::handle_setopt(
      verbose = TRUE,
      customrequest = "rm files/my_file.txt"
    )
  
)

I also tried using customrequest = "DELETE files/my_file.txt" but nothing

To check if it works in the command line tool curl

In Powershell, the below works fine

curl sftp://username:password@server-ip-address -Q 'rm files/my_file.txt'

Any help would be appreciated

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.