Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.61.0411301347120.26457@gannet.stats>
Date: 2004-11-30T13:51:17Z
From: Brian Ripley
Subject: Opening connection to FTP site
In-Reply-To: <8975119BCD0AC5419D61A9CF1A923E950121B8AC@iahce2knas1.iah.bbsrc.reserved>

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