[R] ftp connections for uploading files

Duncan Temple Lang duncan at wald.ucdavis.edu
Fri Jan 9 22:39:05 CET 2009


Hi Thomas

  Rather than getting into the details of libcurl options
which are quite general and very flexible, I thought
it was easier to write an explicit ftpUpload() function
that takes care of the details.

You need a new version of the package (as it contains the function and
a small change to the C code), but I don't have the time to build the 
Windows version for the next few days.

The function can be used as

   ftpUpload("path/to/file", "ftp://server/path/to/target/file",
              userpwd = "login:password")

and you can deal with contents in memory too rather than from a file.


  HTH,
    D.

Thomas Loridan wrote:
> Thanks a lot Duncan
> 
> Sorry to insist with my questions but I am very lost with these Rcurl
> commands...
> could you point out the few ones I need to set up an ftp connection
> and just upload a file ?
> 
> Greatly appreciated
> 
> Thomas
> 
> 2009/1/8 Duncan Temple Lang <duncan at wald.ucdavis.edu>:
>>
>> Prof Brian Ripley wrote:
>>> Try system() with curl or a decent ftp client (I don't see that package
>>> RCurl covers this, but it might despite its description only mentioning
>>> HTTP).
>> It does support FTP, and all of the protocols that are supported in
>> the installed libcurl, so it depends the configuration options for libcurl
>> itself.
>>
>> The protocols it handles can be found via the curlVersion() function, e.g.
>>
>>> curlVersion()
>> $age
>> [1] 3
>>
>> $version
>> [1] "7.16.3"
>>
>> $vesion_num
>> [1] 462851
>>
>> $host
>> [1] "powerpc-apple-darwin9.0"
>>
>> $features
>>        ipv6          ssl         libz         ntlm gssnegotiate largefile
>>           1            4            8           16           32   512
>>
>> $ssl_version
>> [1] " OpenSSL/0.9.7l"
>>
>> $ssl_version_num
>> [1] 0
>>
>> $libz_version
>> [1] "1.2.3"
>>
>> $protocols
>> [1] "tftp"   "ftp"    "telnet" "dict"   "ldap"   "http"   "file"   "https"
>> [9] "ftps"
>>
>> $ares
>> [1] ""
>>
>> $ares_num
>> [1] 0
>>
>> $libidn
>> [1] ""
>>
>>
>>
>> sessionInfo()
>> R version 2.9.0 Under development (unstable) (2008-09-27 r46576)
>> i386-apple-darwin9.5.0
>>
>> locale:
>> C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>
>> other attached packages:
>> [1] ROOXML_0.1-0        Rcompression_0.4-0  RGoogleDocs_0.2-0
>> [4] SVGAnnotation_0.1-0 lattice_0.17-15     RCurl_0.92-0
>> [7] XML_1.99-0          RTools_0.1-0        bitops_1.0-4
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.9.0
>>
>>
>>
>>>  From 'man curl'
>>>
>>>   curl offers a busload of useful tricks like proxy support, user authen-
>>>   tication,  ftp upload, HTTP post, SSL connections, cookies, file trans-
>>>   fer resume and more. As you will see below, the amount of features will
>>>   make your head spin!
>>>
>>> Ftp protocols (and there are more than one) are fiendishly complicated,
>>> especially if proxies are involved.
>>>
>>> BTW, this is yet another case where knowing your OS would have helped give
>>> a more precise answer. See the posting guide.
>>>
>>> On Thu, 8 Jan 2009, Thomas Loridan wrote:
>>>
>>>> Hi all,
>>>>
>>>> I would like to upload some plots I create wth R via ftp or something
>>>> similar but I don t really understand which command/syntax I should
>>>> use:
>>>> should I go for  make.socket + write.socket or try and create
>>>> environment variables like frp_proxy_user and then ftp my files? how?
>>>>
>>>> many thanks for your help
>>>>
>>>> Thomas
>>>>
>>>> --
>>>> Thomas Loridan
>>>> King's College email: thomas.loridan at kcl.ac.uk
>>>> webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm
>>>>
>>>> ______________________________________________
>>>> R-help at 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.
>>>>
> 
> 
>




More information about the R-help mailing list