使用R中的{curl}包在FTP中创建文件夹

8yoxcaq7  于 11个月前  发布在  其他
关注(0)|答案(1)|浏览(101)

我正在尝试使用{curl}软件包在我的ftp上创建一个新文件夹
这就是我到目前为止所尝试的:
使用自定义请求设置句柄

library(curl)

h <- curl::new_handle() |>
  curl::handle_setopt(customrequest = "MkDir",
                      username = "my_username",
                      password = "my_passowrd"
  )

字符串
需要创建文件夹test

curl::curl_fetch_memory(url = "ftp://my_ip_address/test/",
                     handle = h )


并显示以下错误

Error in curl::curl_fetch_memory(url = "ftp://my_ip_address/test/", handle = h) : 
  Failed initialization


我甚至尝试了customrequest = "ftp-create-dirs"customrequest = "MKD"
错误信息相同
任何指针如何,甚至在哪里阅读更多,将不胜感激

hwamh0ep

hwamh0ep1#

我可以创建一个文件夹,

library(curl)
h <- new_handle()
handle_setopt(h, 
  userpwd = "user:12345", 
  customrequest="MKD test"
);
req <- curl_fetch_memory("ftp://my_ip_address", handle=h)

字符串
自定义请求包含“MKD”命令和您要创建的文件夹的名称。

Error in curl_fetch_memory("ftp://127.0.0.1:5021", handle = h) : 
  RETR response: 257


这真的不是一个错误。状态代码“257”只是意味着文件夹已创建,所以忽略该消息是安全的。

相关问题