#
# SERIEZ / SINGLES
#

export ANZ=10000

echo " - = neu erzeugt"
echo " + = doppelt und überschrieben"

cd $QBASEB
echo ""
echo "durchsuche Quelle: $QBASEB"
echo ""
export zaehler=0

for art in singles seriez
	do
	for typ in softest soft medium hard
		do
		cd "$art/$typ"
		echo ""
		echo "doing $art/$typ ... Doks: `ls | grep -v Thumbs.db | wc -l`"

		ls | grep -v Thumbs.db | head -$ANZ | 
		while read jpg
			do
			zaehler=`expr $zaehler + 1`
			
			if [ -e "$ZBASEB/$art/$typ/in/$jpg" ];
				then
				# DATEI SCHON VORHANDEN
				sum1=`cksum "$QBASEB/$art/$typ/$jpg"|awk -F' ' '{print $1}'`
				sum2=`cksum "$ZBASEB/$art/$typ/in/$jpg"|awk -F' ' '{print $1}'`
				if [ "$sum1" = "$sum2" ];
					then
					# Datei identisch
					echo "$QBASEB/$art/$typ/$jpg $ZBASEB/$art/$typ/in/$jpg " >> $ZBASEB/$art/$typ/doppelt.txt
					export jpgg="$jpg"
					export dummyz=$zaehler"+"
				else
					export dummyz=$zaehler"-"
					export jpgg=`echo $jpg | sed -e 's/\./_\./g'`
					while [ -e "$ZBASEB/$art/$typ/in/$jpgg" ];
						do
						export jpgg=`echo $jpgg | sed -e 's/\./_\./g'`
						done
					echo "$QBASEB/$art/$typ/$jpg $ZBASEB/$art/$typ/in/$jpg " >> $ZBASEB/$art/$typ/Name_geaendert.txt
				fi
				
			else
				# DATEI FRISCH UND NEU
				export dummyz=$zaehler
				export jpgg="$jpg"
			fi;


			echo -n "$dummyz "
#			echo $jpg " ....." $jpgg
#			cp -p "$jpg" "$ZBASEB/$art/$typ/in/$jpgg"
			mv -f "$jpg" "$ZBASEB/$art/$typ/in/$jpgg" 2>/dev/null
			done
		cd ../..
		echo ""

		done
	done
