Try this:

 mapply(download.file, filenames, basename(filenames))

On Thu, Sep 16, 2010 at 11:56 AM, Martin <mar...@bier-mail.de> wrote:

>
> Hi,
>
> I have problems downloading complete folders via ftp with R. Single files
> work fine.
> I tried Rcurl, but it does not work.
> This is my code:
>
> url =
> "
> ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/Derived_Products/3B42_V6/Daily/2009/
> "
> filenames = getURL(url, ftp.use.epsv = FALSE, ftplistonly = TRUE, crlf =
> TRUE)
> filenames = paste(url, strsplit(filenames, "\r*\n")[[1]], sep = "")
>
> no problems until here, I get a list with the files I want. But then, when
> I
> use:
> download.file(filenames, destfile="") I don't know how to tell R to use the
> same names for the destfiles als the filenames.
>
> If i use:
> con = getCurlHandle( ftp.use.epsv = FALSE)
> contents = sapply(filenames[1:5], getURL, curl = con)
> names(contents) = filenames[1:length(contents)]
>
> I get an "error in curlPerform".
>
> I know, it's easy to download ftp folders with appropriate programs, but i
> want to manage to get it work in R....
>
> greets
> Martin
> --
> View this message in context:
> http://r.789695.n4.nabble.com/FTP-Download-tp2542359p2542359.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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 via email to