0

I have 30 files: f1.csv, f2.csv, ... f30.csv. I would like to upload all files with R, about as:

ftpUpload(c(f1.csv, f2.csv, ... f30.csv), http://..., ...)

How can I to upload with the command ftpUpload many files?

Shen
  • 183
  • 1
  • 10

1 Answers1

1

As @Soheil mentions, why not just save the files first, then upload?


Any reason you can't just do a for loop?

Something like:

files = c("f1.csv", "f2.csv", "f30.csv")
for (file in files){
    ftpUpload(file,
            paste("ftp://...",file,sep = ""),
            )
}
EconomiCurtis
  • 2,107
  • 4
  • 23
  • 33
  • 1
    Thank you, but by ftpUpload(file; "http... user:...pw...") we need every time authorization. Server reported error, Sleep() oes not help. – Shen May 25 '15 at 09:31
  • Isn't that just another argument you pass into ftpUpload()? I am not that familiar with that particular function, but the documentation website suggests you can give authorization via the "userpwd" arguement. Or in the FTP URL (e.g. "ftp://login:password@urwebsite.com/ftp/site"). http://web.mit.edu/r_v3.0.1/lib/R/library/RCurl/html/ftpUpload.html – EconomiCurtis May 25 '15 at 18:03