There is a gallery in the format:

http:\\DOMAIN\file0001.jpghttp:\\DOMAIN\file0543.jpg

How can I download them all using wget?

How can I make it wait 2 seconds between downloads?

i'm using bash ver 3.2.

link|improve this question
2  
FYI, URLs use forward slashes (http://domain/), never backslashes. – grawity Sep 29 '11 at 11:42
feedback

2 Answers

up vote 2 down vote accepted

In bash:

for ((i=1; i<=500; i++)); do wget http://DOMAIN/file`printf "%04d" $i`.jpg; done

If you want to wait 2 seconds between downloads, add a sleep 2; before the done

link|improve this answer
feedback

Use ranges with {..}.

$ wget http://example.com/file{0001..0543}.jpg

The above answer works with zsh and bash version 4 and above. See the answer posted by @w00t if you're using an older version of bash (bash -version to check).

enter image description here

link|improve this answer
That doesn't keep the starting 0s – w00t Sep 29 '11 at 9:58
Cool, didn't know that. Now for the long wait until all bashes are v4 :-) – w00t Sep 29 '11 at 11:58
feedback

Your Answer

 
or
required, but never shown

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