Gixxy22
Gixxy22

Reputation: 507

Specify output names on multiple files with curl using ranges

I am trying to download a few hundred URL's and specify the output name for each, the only difference is an ID in the URL, such as ..something/1/something.., ..something/3/something.., ..something/4/something.. etc.

I can use -o filename.zip but it will overwrite for each of the range of files, I am currently using:

curl -o file.zip http://example.com/something/[1-500]/something/example/foo/bar/comma/zip

How can I output as this:?

file1.zip, file3.zip, file4.zip, ..etc

Upvotes: 0

Views: 573

Answers (1)

Hans Z.
Hans Z.

Reputation: 54118

A simple loop in your shell would do the trick e.g.:

#!/bin/bash
for i in `seq 1 500`; do
    curl -o file$i.zip http://example.com/something/$i/something/example/foo/bar/comma/zip
done

Upvotes: 1

Related Questions