Files
q-tools/numberDL
2012-11-13 19:54:04 +02:00

40 lines
701 B
Bash
Executable File

#!/bin/bash
if [ -z "$1" ]
then
echo "use: $0 http://etc/ 01 .jpg 30 wget"
echo "length of first number as a string defines padding"
exit
fi
jotai="$1"
paate="$3"
# From
i=$( echo $2 | sed 's,^0\+,,' )
if [ "$i" = "" ]
then i=0
fi
# To
t=$4
# xargs to
comm=$5
pad=${#2}
if [ -z "$comm" ]
then comm="echo"
fi
while [ "$i" -le "$t" ]
do
j=$( printf "%0${pad}d" $i )
if [ "$comm" = "wget" ]
then
echo oo
# wget -S --spider | grep __error codes.. (or OK)
wget -U 'Mozilla/4.0 (compatible: MSIE 5.5: Windows NT 5.0)' --referer="${jotai}${j}${paate}" "${jotai}${j}${paate}"
else
echo ${jotai}${j}${paate} | xargs $comm
fi
let "i = 1 + $i"
done