[Solved] Download files with specific extension from a website [closed]
library(stringr) # Get the context of the page thepage = readLines(‘https://data.giss.nasa.gov/impacts/agmipcf/agmerra/’) # Find the lines that contain the names for netcdf files nc4.lines <- grep(‘*.nc4’, thepage) # Subset the original dataset leaving only those lines thepage <- thepage[nc4.lines] #extract the file names str.loc <- str_locate(thepage,’A.*nc4?”‘) #substring file.list <- substring(thepage,str.loc[,1], str.loc[,2]-1) # download all files for … Read more