I am attempting to download several thousand image files. I have written a loop that works as long as there are no problem files or URL errors.
For example:
URLs <- c("https://api.idigbio.org/v2/media/d201d0b9af2bfe78e3203820d10fdca9?
size=fullsize",
"https://api.idigbio.org/v2/media/a2b9b1510c60e8a41f7ae0552c7e51ba?
size=fullsize",
"http://usuherbarium.usu.edu/UTCimages/140/UTC00130056_lg.jpg",
"https://api.idigbio.org/v2/media/fe113f423971f51a58caf9bfc90a5171?
size=fullsize")
for(i in seq_along(URLs)){
download.file(URLs[i],basename(URLs[i]),mode="wb")
}
In this particular example, there is a problem with the 3rd URL and my code just stops. I would like to skip the problems ones and continue to download the ones that work. How can I do that? Ideally, I would also generate a list of the ones that were skipped, but my biggest priority is to continue the process without stopping.
Thanks in advance.