how to specify or name the downloaded file?

this is the code im using to download a pdf file , ijust don't know how to specify or name the downloaded file.... thanks in advance

rD <- rsDriver(browser="firefox", port=4445L,verbose = F)
remDr <- rD[["client"]]
ffd <- rD$client
url1 <- 'http://www.bvmt.com.tn/fr/entreprises/list'
ffd$navigate(url1)
elements1 <- ffd$findElements("id", "pano-societe")
elements1[[1]]$clickElement()
webElem1 <- ffd$findElement("css selector", "li.tt2:nth-child(14) > a:nth-child(1)")
webElem1$clickElement()
elements2 <- ffd$findElements("class", "savoir-plus-actu")
elements2[[1]]$clickElement()
page3<-ffd$getCurrentUrl()
page<-read_html(page3[[1]])
raw_list<- page %>%
html_nodes("a") %>%
html_attr("href") %>%
str_subset("\.pdf") %>%
walk2(., basename(.), download.file, mode = "wb")

maybe rename them after you downloaded them ?

so there is no way to name the downloaded file in r ?

Ok. So I looked in the documentation and there is a destfile parameter (destination file path)

2 Likes

OK, thanks, I will look that up

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.