Wrap the call that may abort with try() or tryCatch(). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com
> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Rainer > Schuermann > Sent: Friday, September 16, 2011 1:09 PM > To: r-help@r-project.org > Subject: Re: [R] download files using ftp: avoid error > > I haven't tested it thoroughly but what worked here is replacing > > download.file(url, destfile, quiet = FALSE) > with > > sys_call <- paste( "wget", url, ">", destfile, sep=" " ) > system( sys_call ) > > Program execution continues, whether or not the download from url was > successful. However, wget is, I believe, not available on Windows. > > Rgds, > Rainer > > > On Friday 16 September 2011 15:07:15 Mary Kindall wrote: > > I am planning to download a large number of files from some website. I am > > using the following script. > > > > files2down = c('aaa', 'bbb', ................) > > for (i in 1: len) > > { > > print(paste('downloading file', i, ' of total ', len)); > > url = paste(urlPrefix, files2down[i], sep='') > > destfile = paste (dest, 'inDir', files2down[i], sep='/' ) > > download.file(url, destfile, quiet = FALSE) > > } > > > > It works fine as long as the file is present. When the file is not present, > > it exit from loop. Is there a way to continue looping if error occurs. > > Thanks > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.