curl – 下载文件范围

我正在尝试使用curl来下载一系列文件。

curl -R -O -z /dir/file1.png http://somesite.com/file[1-100].png 

我遇到的问题是如何使“file1.png”更改为当前正在下载的批处理范围#。 我努力了 :

 curl -R -O -z /dir/file#1.png http://somesite.com/file[1-100].png 

但是,这打破了“-z”选项(只有在远程文件比本地副本更新的情况下才会下载)

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

我该如何解决?

我不能想办法做到这一点,并重新使用连接,但你可以做一个for循环和每次一个新的连接。 在bash ,例如:

 for i in {1..100}; do curl -R -O -z /dir/file${i}.png http://somesite.com/file${i}.png; done 

你有没有尝试某个date:

 curl -R -O -z "Aug 14 2011" /dir/file#1.png http://somesite.com/file[1-100].png