5

First I should say that a lot of this is over my head, so I apologize in advance for using incorrect terminology and potentially asking an unclear question. I'm doing my best.

Also, I saw ThisPost; is RCurl the tool I want to use for this task?

Every day for 4 months I'll be analyzing new data, and generating .csv files and .png's that need to be uploaded to a web site so that other team members will be checking. I've (nearly) automated all of the data collecting, data downloading, analysis, and file saving. The analysis is carried out in R, and R saves the files. Currently I use Filezilla to manually upload the new files to the website. Is there a way to use R to upload the files to the web site, so that I don't have to open Filezilla and drag+drop files?

It'd be nice to run my R-code and walk away, knowing that once it finishes running, the newly saved files will be automatically be put on the website.

Thanks for any help!

Community
  • 1
  • 1
rbatt
  • 4,677
  • 4
  • 23
  • 41
  • 2
    Does Filezilla have a command line mode? R has a `system` function that can issue command to the OS. – IRTFM May 04 '13 at 15:52
  • 1
    It looks like it might, but this would be a technique that I could use, but not craft. Is the idea still use FileZilla, but to run it through R > OS Command Line > FileZilla? So just skip the FileZilla GUI, but let it still do its thing? [HERE](https://wiki.filezilla-project.org/Command-line_arguments_(Client)) is the FileZilla Wiki link about command line. Thanks for pointing in this direction, sounds like a solid approach. – rbatt May 04 '13 at 17:34
  • 1
    https://wiki.filezilla-project.org/Command-line_arguments_%28Server%29 – IRTFM May 04 '13 at 17:42

1 Answers1

4

You didn't specify which protocol you use to upload your files using FileZilla. I assume it is ftp. If so, you can use the ftpUpload function of RCurl:

library(RCurl)
ftpUpload("yourfile", "ftp://ftp.yourserver.foo/yourfile", 
    userpwd="username:passwd")

RCurl also had methods for scp and should also support sftp using ftpUpload.

Community
  • 1
  • 1
Jan van der Laan
  • 8,005
  • 1
  • 20
  • 35
  • Your post is encouraging. How do I check to see what protocol I am using w/in FileZilla. I **thought** it was FTP, but I could be wrong. I just did some poking, and when I find one of the .html files in FileZilla, and ask FileZilla to copy the URL, it has a format like "ftp://site.net/web/folder/folder/Page.html". I'm guessing that means it's FTP, right? – rbatt May 04 '13 at 18:37
  • 1
    @rbatt If you didn't specifically specify anything and your host (see top left in FileZilla) doesn't start with sftp: then it is probably ftp. You could also check your the message log in filezilla, when connecting it shows the ip address followed by the post (something like 123.123.123.123:21 where 21 is the port) when the post is 21 then it is usually ftp. – Jan van der Laan May 04 '13 at 19:04
  • OK, I tried this code, and I'm getting closer. However, I get the message, `Error in function (type, msg, asError = TRUE) : Server denied you to change to the given directory` I think this is because the page to which I need to upload the file is a password-protected to page --- if I navigate to the URL using a browser, I have to enter a user name and password, both of which are different from the name/pass I have to use to connect to the server in FileZilla. How do I enter this additional information in R? – rbatt May 04 '13 at 19:20
  • Also, it is definitely FTP. Thanks for the tips. – rbatt May 04 '13 at 19:23
  • Nevermind, I messed up part of the path ... thank you so much for your help with this!!! Brilliant! – rbatt May 04 '13 at 19:37