all=0

if [ $# -eq 0 ] ; then
	echo better with an argmument
	exit
fi

if [ -d apnquad ] ; then
	dir=apnquad
fi
if [ -d toto/apnquad ] ; then
	dir=toto/apnquad
fi

echo ==============================================
echo  $( hostname ) $dir
uptime
nbf=0
all=0
cd $dir

mkdir -p /tmp/glue
rm -rf   /tmp/glue/*

for idt in {0..91}; do
	if [  -d task/$idt ] ; then
		count=0
		map=0
		let num=$idt*1000
		liste=/tmp/glue/liste-$idt.list
		for (( i=0; i < 1000; i++ ))
			do
			file=task/$idt/$num/apn-$num-8.out
        		if [ -s $file ] ; then
				let count++
				tmp=$( stat --format="%s" $file )
				let tmp/=64
				let map+=tmp
				echo $file  >> $liste
       		 	fi
			let num++
			done
		let nbf+=count
		let all+=map
		if [ $count -gt 0   ]; then
		   ./glue.exe -l8 $( cat $liste ) -f -p$idt -d/tmp/glue -w
		fi

	fi
done
echo  ---
./glue.exe  -l8 /tmp/glue/*.out  -fw 
./convert.exe -i /tmp/glue-pid-8.out  -o collect-$1-8.txt
echo  files:$nbf  apns:$all
echo all apns are in file collect-$1-8.txt
wc -l collect-$1-8.txt


