Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

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

2 Answers 2

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

share|improve this answer
add comment

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

share|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
add comment

Your Answer

 
discard

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.