[R] having error of downloading multiple files from password protected ftp in R

Jia Shen jia.t.shen at gmail.com
Thu Aug 13 22:51:08 CEST 2015


Hi all,

I'm trying to download a bunch of files from a credential needed ftp
address using R.* Below is my code:*
==========================
library(RCurl)
url <- "ftp://xxx.com"
userpwd <- "user:pwd"
filenames <- getURL(url, userpwd = userpwd, ftp.use.epsv =
FALSE,dirlistonly = TRUE)
fn <- unlist(strsplit(filenames, "\r\n"))
destdir <- "C:\\xxx\\destfolder"

lapply(fn, function(x) download.file(url=paste0(url,"/", x),
destfile=paste0(destdir,"/", x)),method="curl")


*The error message i got is below: *

trying URL 'ftp://FTP.weatherbank.com/CYTZ-FULL.XLSB'

 Error in download.file(url = paste0(url, "/", x), destfile =
paste0(destdir,  :
  cannot open URL 'ftp://xxx.com' In addition: Warning message:
In download.file(url = paste0(url, "/", x), destfile = paste0(destdir,  :
  InternetOpenUrl failed: 'The login request was denied


============================

Can anyone help? have been working on this issue for a couple of hours.

Thanks!

Tracy

	[[alternative HTML version deleted]]



More information about the R-help mailing list