[R] Opening connection to FTP site
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Nov 30 14:51:17 CET 2004
On Tue, 30 Nov 2004, michael watson (IAH-C) wrote:
> Hi
>
> Is it possible to open a connection to an FTP site such that I can read
> the directory listing? Eg:
>
> URL <- url("ftp://ftp.ensembl.org", open="r")
> Error in url("ftp://ftp.ensembl.org", open="r") :
> unable to open connection
>
> URL <- url("ftp://ftp.ensembl.org")
> open(URL)
> Error in open.connection(URL) : unable to open connection
>
> I think perhaps it is because there isn't actually a file there to
> connect to, eg this works fine:
>
> URL <- url("ftp://ftp.ensembl.org/pub/README", open="r")
It is not possible using url(). Try, e.g.
tmp <- tempfile()
download.file("ftp://ftp.ensembl.org", tmp, method="lynx") # or "wget"
readLines(tmp)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list