Download zip files from a link to a PC folder through R


Good afternoon

I need to download the zip files from the following website

I would like to download via R, and that the files were saved on my computer, but I don't know the command to do so.

As there are a lot of files, downloading them manually would be very time consuming.

Thank you very much in advance


You can do it like this, using the curl package:


url_opcoes <- ""
con <- curl(url_opcoes)
arquivos <- read_delim(con, delim = " ", col_names = FALSE)$X4

for (x in arquivos) 
  curl_download(url = paste0(url_opcoes, x), destfile = paste0("data/", x))

This code would download all the files that are in the Bovespa-Opcoes directory of that FTP.

Scroll to Top