#!/bin/sh
##wget -r -np -nH https://cpkg.datto.com/datto-rpm/EnterpriseLinux/
#i='5'
#wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/$i/x86_64/
#if [ ! -d "$i" ];then
#	mkdir "$i"
#fi
#mv *.rpm "$i"
#
#for j in {0..11}
#do
#	wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/"$i.$j"/x86_64/
#	if [ ! -d "$i.$j" ];then
#		mkdir "$i.$j"
#	fi
#	mv *.rpm "$i.$j"
#done
#
i='6'
wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/$i/x86_64/
if [ ! -d "$i" ];then
	mkdir "$i"
fi
mv *.rpm "$i"

for j in {0..10}
do
	wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/"$i.$j"/x86_64/
	if [ ! -d "$i.$j" ];then
		mkdir "$i.$j"
	fi
	mv *.rpm "$i.$j"
done

i='7'
wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/$i/x86_64/
if [ ! -d "$i" ];then
	mkdir "$i"
fi
mv *.rpm "$i"

for j in {0..10}
do
	wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/"$i.$j"/x86_64/
	if [ ! -d "$i.$j" ];then
		mkdir "$i.$j"
	fi
	mv *.rpm "$i.$j"
done

i='8'
wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/$i/x86_64/
if [ ! -d "$i" ];then
	mkdir "$i"
fi
mv *.rpm "$i"

for j in {0..4}
do
	wget -r -np -nH -nd -A rpm https://cpkg.datto.com/datto-rpm/EnterpriseLinux/"$i.$j"/x86_64/
	if [ ! -d "$i.$j" ];then
		mkdir "$i.$j"
	fi
	mv *.rpm "$i.$j"
done
