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

21 views
Skip to first unread message

Jia Shen

unread,
Aug 13, 2015, 11:04:54 PM8/13/15
to r-h...@r-project.org
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]]

______________________________________________
R-h...@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply all
Reply to author
Forward
0 new messages