TransWikia.com

Curl - download file range

Server Fault Asked on November 10, 2021

I’m trying to download a range of files using curl.

curl -R -O -z /dir/file1.png http://somesite.com/file[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 http://somesite.com/file[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?

2 Answers

Did you try with a certain date:

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

Answered by quanta on November 10, 2021

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 http://somesite.com/file${i}.png; done

Answered by Handyman5 on November 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP