Download sequence of files using Curl

In day to day life we used to download useful stuff from world wide web, sometime requirement to download sequence of files, one way is to do it manually by clicking individual links or automate the download using Curl.

Showing you that next, how we can do it.

grab Curl from : http://curl.haxx.se/download.html

Curl has the ability to set sequences (including with leading zeroes, and alphanumeric sequences) as part of the download command which makes it a lot easier. This is all covered in the man page so I suggest reading it for a complete understanding of the options available.

To download the blue icons from 00 to 09 with curl, do this:curl -O http://google-maps-icons.googlecode.com/files/nits0[0-9].png
The -O flag tells curl to write the file out as a file instead of to standard output.

Because curl supports leading zeroes in the sequence we can also easily download the images from 00 to 20 with just one command:curl -O http://google-maps-icons.googlecode.com/files/nits[00-25].png

 

About nitingautam

I am Tech Lead (Java/J2EE/ExtJs) with a MNC located @ Gurgaon.
This entry was posted in unix and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *