How to upload a file to a server via FTP using R?

2020-02-09 10:55发布

How to upload a file to a server via FTP using R?

4条回答
何必那么认真
2楼-- · 2020-02-09 11:01

This probably isn't the answer you're looking for, but I solve my sharing problems by moving the file to my Public dropbox folder and link to that in my R code.

My two pennies.

查看更多
ら.Afraid
3楼-- · 2020-02-09 11:20

If you can access it from the command line, then you can do:

system("ftp ...") # where ... is the argument list

You could easily wrap this in an R function if you plan on doing it often.

查看更多
Rolldiameter
4楼-- · 2020-02-09 11:21

This should work:

library(RCurl)
ftpUpload("Localfile.html", "ftp://User:Password@FTPServer/Destination.html")

Where Localfile.html is the file to be uploaded, User indicates the user name and Password the password to log into the server while FTPServer is a placeholder for the server name and possible path to use while last but not least Destination.html is an example of the name the to be uploaded file gets on the server.

查看更多
欢心
5楼-- · 2020-02-09 11:25

Your best bet may be the RCurl package. From the DESCRIPTION:

[...] Additionally, the underlying implementation is robust and extensive, supporting FTP/FTPS/TFTP (uploads and downloads),

Otherwise, rethink your problem. Maybe HTTP POST will do as well. It's not 1986 anymore so you're not required to use ftp.

查看更多
登录 后发表回答