Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm trying to download a range of files using curl.

curl -R -O -z /dir/file1.png[1-100].png

The problem I'm having is how to make the "file1.png" change to the approperate range # that is currently being downloaded. I have tried :

curl -R -O -z /dir/file#1.png[1-100].png

However, that breaks the "-z" option (only download if remote file is newer than a local copy) with the error :

Warning: Illegal date format for -z/--timecond (and not a file name). 
Warning: Disabling time condition. See curl_getdate(3) for valid date syntax.

How do I fix this?

share|improve this question
why not use wget instead? – Zoredache Aug 15 '11 at 3:47
curl keeps the connection open until it's done - wget keeps opening a new connection for each file – Dave Aug 15 '11 at 3:58

I can't think of a way to do this and re-use the connection, but you could do it with a for loop and a new connection each time. In bash, for instance:

for i in {1..100}; do curl -R -O -z /dir/file${i}.png${i}.png; done
share|improve this answer

Did you try with a certain date:

curl -R -O -z "Aug 14 2011" /dir/file#1.png[1-100].png
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.