Issue
I am trying to create a new folder on my ftp using the {curl}
package
This is what I tried so far:
Set up a handle with a custom request
library(curl)
h <- curl::new_handle() |>
curl::handle_setopt(customrequest = "MkDir",
username = "my_username",
password = "my_passowrd"
)
The folder test
needs to be created
curl::curl_fetch_memory(url = "ftp://my_ip_address/test/",
handle = h )
with the following error
Error in curl::curl_fetch_memory(url = "ftp://my_ip_address/test/", handle = h) :
Failed initialization
I even tried the customrequest = "ftp-create-dirs"
and customrequest = "MKD"
with the same error message
Any pointers to how , or even where to read more, it would be appreciated
Solution
I was able to create a folder using
library(curl)
h <- new_handle()
handle_setopt(h,
userpwd = "user:12345",
customrequest="MKD test"
);
req <- curl_fetch_memory("ftp://my_ip_address", handle=h)
The custom request has both the "MKD" command and the name of the folder you want to create. I get a response of
Error in curl_fetch_memory("ftp://127.0.0.1:5021", handle = h) :
RETR response: 257
Which really isn't an error. The status code "257" just means that the folder was created so it's safe to ignore that message.
Answered By - MrFlick Answer Checked By - Senaida (WPSolving Volunteer)