download a series of files automatically using command line/wget
You haven't stated OS, but if you are using *nix and Bash the following works:
wget http://server6.mp3quran.net/abkr/{001..114}.mp3
A solution that should work with any shell:
#!/bin/sh
for i in $(seq -w 1 114); do
printf 'http://server6.mp3quran.net/abkr/%s.mp3 ' $i
done | xargs wget
or, if seq
does not exist on the system:
#!/bin/sh
i=1
MAX=114
while [ $i -le $MAX ]; do
printf 'http://server6.mp3quran.net/abkr/%03d.mp3 ' $i
i=$((i+1))
done | xargs wget
Just copy+paste it in the shell or save it in a script file and run it.
For the sake of completeness, here's a batch-only solution:
@ECHO OFF
SetLocal EnableDelayedExpansion
FOR /L %%G IN (1, 1, 114) DO (
SET num=%%G
IF 1!num! LSS 100 SET num=0!num!
IF 1!num! LSS 200 SET num=0!num!
wget http://server6.mp3quran.net/abkr/!num!.mp3
)
EndLocal
Edit 1: Removed unnecessary braces.
Edit 2: Corrected counter start value to 1.
For a Windows solution, try the following PowerShell script:
$Client = New-Object System.Net.WebClient
for ($i = 1; $i -le 144; $i++)
{
$file = [string]::Format("{0:D3}.mp3", $i)
$Client.DownloadFile("http://server6.mp3quran.net/abkr/" + $file, $file)
}
First cd
into the directory you want to download the files to, of course.