#' Delete Files in FTP Directory
#'
#' Allows you to delete files in the FTP directory
#'
#' @param host The FTP host url
#' @param userpwd login username and password colon seperated
#' @param fileList List of file names usually generated by getFTPFileList function
#' @return NULL
#' @export
##TODO: Add silenty return value
#### Erase a file(s) from FTP ####
deleteFTPFiles <- function(host, userpwd, fileList) {
#by default the server throw a response that appears to be an error
#however, status of 250 means the task was completed successfully
#so we create error handling for this response.
for(i in fileList) {
tryCatch(
RCurl::curlPerform(url = host,
customrequest = paste("DELE",i),
userpwd = userpwd),
error = function(e) {
if(grepl("250", e)) {
print(paste("Successfully Deleted", i))
} else {
print(e)
}
},
warning = function(w) print(w)
)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.