Batch Downloading Numbered Files

    The following script will download a sequence of numbered files.

#! /bin/bash
for x in `seq -w 60 181`
do
   wget "http://www.site.com/DGW-"$x".mp3"
done

    So in this case it will download DGW-060.mp3, DGW-061.mp3 … DGW-181.mp3. 

    Getting the script to loop through a sequence of numbers was tricky until I found the seq command.  The -w parameter will pad the numbers with zeros so they all have the same number of digits.  

COMMENTS