Index: trunk/MagicSoft/Mars/datacenter/scripts/checkmd5sum
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/checkmd5sum	(revision 8886)
+++ trunk/MagicSoft/Mars/datacenter/scripts/checkmd5sum	(revision 9114)
@@ -62,4 +62,5 @@
 
 date | tee ${checkpath}/tape_${id}.md5.lapalma | tee ${checkpath}/tape_${id}.md5.wue
+muxslog=`grep muxdata/20[01][0-9].*/20[01][0-9].*.raw $file | wc -l`
 
 # read the tapecont file line by line
@@ -67,7 +68,7 @@
 do
    muxchk=`echo $line | cut -d/ -f1`
-   type=`echo $line | cut -d_ -f7 | cut -c0-5`
+   type=`echo $line | sed -e 's/.*20[01][0-9]\{5\}_.*\(.raw\)/\1/' | cut -c 0-4`
    # only check muxdata rawfiles, not cc-, caco- or drivelog-files
-   if [ "$muxchk" = "muxdata" ] && [ "$type" = "E.raw" ]
+   if [ "$muxchk" = "muxdata" ] && [ "$type" = ".raw" ]
    then
       sum=($line)
@@ -103,5 +104,4 @@
 echo "Wrote checksums to ${checkpath}/tape_${id}.md5.lapalma and ${checkpath}/tape_${id}.md5.wue. Comparing now."
 
-
 # check for differences in the checksums
 output=`diff ${checkpath}/tape_${id}.md5.lapalma ${checkpath}/tape_${id}.md5.wue`
@@ -109,5 +109,12 @@
 if [ "$output" = "" ]
 then
-   echo "All checksums are ok! Launching movingrawfiles now."# to be included
+   echo "All checksums are identical!"
+   muxschk=`grep muxdata/20[01][0-9].*/20[01][0-9].*.raw ${checkpath}/tape_${id}.md5.wue | wc -l`
+   if [ $muxslog == $muxschk ]
+   then
+      echo "Number of checked files matches. Launching movingrawfiles now. (to be included)" | tee -a ${checkpath}/tape_${id}.md5.lapalma | tee -a ${checkpath}/tape_${id}.md5.wue
+   else
+      echo "Number of checked files doesn't match number of extracted files. Something went wrong..." | tee -a ${checkpath}/tape_${id}.md5.lapalma | tee -a ${checkpath}/tape_${id}.md5.wue
+   fi
 else
    echo -e "The files are not identical! diff found the following differences:\n$output"
