Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I save images with:

for i in {1..30000}
    wget ""$i

Is there a way to speed up the process? Sometimes a URL does not exist and I get:

HTTP request sent, awaiting response... 404 Not found
2012-08-04 18:09:36 ERROR 404: Not found.

How can I continue after this error?

share|improve this question
If you have an additional question about how to download out only certain object, please ask an additional question. Mixing two subjects in one question just over-complicates the matter :) – Oliver Salzburg Aug 4 '12 at 16:26
@OliverSalzburg - Your comment is spot on. But you chose to edit the title to reflect the question you answered. Neglecting to notice that there where two answers answering his other question. – Nifle Aug 4 '12 at 16:37
@Nifle: Feel free to read the history of the question and change it if you feel that I've missed the point with my edit. Also, please note that I edited and commented on the question before I wrote my answer. – Oliver Salzburg Aug 4 '12 at 16:39
up vote 7 down vote accepted


wget "http://s.../m=itemdb_rs/3809_obj_sprite.gif?id="$i || true

This way, if wget fails, the result of that line is still zero and your script continues.

To learn how to properly handle errors in a bash script, check out the following resources:

share|improve this answer
+1 This is a good suggestion! – Canha Aug 4 '12 at 17:07

You could try something like this.

for i in {1..30000};
if [[ $(echo $(GET -sd $x | grep "404")) = "" ]]; 
wget --no-dns-cache -nc -U"Firefox/10" $x 2>&1 \
| grep "Saving" | sed 's,Saving to,Saved,'; 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.