Index: trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles
===================================================================
--- trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles	(revision 9081)
+++ trunk/MagicSoft/Mars/datacenter/scripts/movingrawfiles	(revision 9091)
@@ -51,15 +51,6 @@
 ssh tape@dc07 chmod -R g+w /magic/datacenter/fromtape/rawdata/* >> $scriptlog 2>&1
 
-printprocesslog "INFO moving directories from muxdata to rawdata"
-# find directories which have to be copied
-days=`find /magic/datacenter/fromtape/muxdata/* -type d`
-if [ ! "$days" == "" ]
-then
-   # move directories to the tapedirectory
-   mv -v $days /magic/datacenter/fromtape/rawdata/ >> $scriptlog 2>&1
-fi
-
-# find rawfiles
-rawfiles=`find /magic/{datacenter,data/rawfiles}/fromtape/*data/ -regextype posix-egrep -regex '.*/20[01][0-9]{5}_(M[12]_)?[0-9]{8}(\.[0-9]{3})?_.*.raw' -type f`
+# find rawfiles belonging to tape (don't move files not yet md5-sum checked)
+rawfiles=`find /magic/{datacenter,data/rawfiles}/fromtape/???data/ -regextype posix-egrep -regex '.*/20[01][0-9]{5}_(M[12]_)?[0-9]{8}(\.[0-9]{3})?_.*.raw' -type f -user tape`
 
 if [ "$rawfiles" == "" ]
@@ -69,4 +60,5 @@
 fi
 
+# move rawfiles
 printprocesslog "INFO moving rawfiles to $datapath/rawfiles"
 for rawfile in $rawfiles
@@ -77,5 +69,6 @@
    if [ "$path" == "datacenter" ]
    then
-      newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/rawdata/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
+      subpath=`dirname $rawfile | cut -d/ -f5`
+      newrawfile=`echo $rawfile | sed -e 's/center\/fromtape\/'${subpath}'/\/rawfiles/g' -e 's/_/\//1' -e 's/_/\//1'`
    elif [ "$path" == "data" ]
    then
@@ -93,5 +86,5 @@
 done
 
-rmdir -v /magic/{datacenter,data/rawfiles}/fromtape/*data/* >> $scriptlog 2>&1
+rmdir -v /magic/{datacenter,data/rawfiles}/fromtape/???data/* >> $scriptlog 2>&1
 
 printprocesslog "INFO launching filesondisk"
