destpath=$1
host=$2
reseller=$3
password=$4

cd $destpath
wget http://$reseller:$password@$host:2086/scripts/fetchcsv
for domaininfo in `cat $destpath/fetchcsv | tr " " ","` ; do
        domain=`echo $domaininfo | cut -d, -f2`
        user=`echo $domaininfo | cut -d, -f4`
	skin=`echo $domaininfo | cut -d, -f15`
        mkdir $domain
        cd $domain
        wget http://$user:$password@$host:2082/frontend/$skin/backup/index.html
        for file in `cat index.html | grep href | cut -d\" -f 2` ; do 
		if [ "`echo $file | head -c 1`" == "/" ] ; then
	                wget http://$user:$password@$host:2082$file
		fi
        done
	rm -f index.html
        cd ..
done

