With the ftpUpload() function of the RCurl package for R, I am able to upload a file on a FTP server. But how to create a new folder on the FTP server from R ? And how to delete a file or a folder ?
It works for me, but the correct quote command is DELE, not DELETE! Here a list of commands http://www.nsftools.com/tips/RawFTP.htm
So try:
curlPerform(url="ftp://xxx.xxx.xxx.xxx/", quote="DELE file.txt", userpwd = "user:pass")
In order to create a new folder, you can simply include the full path when you upload a file, and enable the ftp.create.missing.dirs option:
.opts <- list(ftp.create.missing.dirs=TRUE)
user <- "yourlogin"
pwd <- "yourpassword"
RCurl::ftpUpload(what = "filename.txt", to = "ftp://yourserver.com:21/newFolder/filename.txt", userpwd = paste(user, pwd, sep = ":"), .opts = opts)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With