path1<-"https://www.sec.gov/files/dera/data/" path2<-"financial-statement-data-sets/" for(y in 2009:2020){ for(q in 1:4){ inF<-paste0(path1,path2,y,"q",q,".zip") outF<-paste0("finS",y,"q",q,".zip") download.file(inF,outF,mode="wb",method="libcurl",quiet=T) } }