M=/data1
status=$M/status

if [ -r $1 ]; then
 f=$1
else
 f=/tmp/f.$$
 rm -f $f
 echo $1 >$f
fi

cat $f | while read t; do 
   if [ -r $status/$t.done ]; then 
	echo $t finished
        continue
   fi
   $M/migrate_tape -v $t >/dev/null 2>/dev/null
   rc=$?
   if [ $rc -eq  0 ]; then
      if [ -r $status/$t.copy2b ]; then 
	 echo $t ready for copy
      else
	 echo $t ready, ERROR missing  touch $status/$t.copy2b
      fi
   else
      if [ -r $status/$t.copy2b ]; then 
	 echo $t NOT ready, ERROR. rm $status/$t.copy2b
      else
	 echo $t not ready
      fi
   fi
done
