oldname=0
#find /var/spool/ifmail/outb -type d -print |
echo /var/spool/ifmail/outb |
while read dir
do
  cd $dir
  for i in *.[smtwf][auoehr]?
  do
    if echo $i | fgrep -q '*'; then break; fi
    name=`echo $i | sed 's/\..*//g'`
    if [ $oldname != $name ]
    then
      n=`echo $i | sed 's/........$//g'`
      n=`printf "%d" 0x$n`
      n=`expr 464 - $n`
      f=`echo $i | sed 's/^....\(....\)..../\1/g'`
      f=`printf "%d" 0x$f`
      f=`expr 200 - $f`
      if [ $n -lt 0 ]; then n=`expr 65536 + $n`; fi
      if [ $f -lt 0 ]; then f=`expr 65536 + $f`; fi
      flo=`echo $n $f | awk '{ printf "%04x%04x",$1,$2 }'`.flo
    fi
    oldname=$name
    if [ -f $flo ]
    then
      if fgrep -q $i $flo
      then echo $dir/$i already in $flo; continue; fi
    fi
    echo Reattaching $dir/$i into $flo
    echo '#'$dir/$i >> $flo
    chown fnet.fnet $flo
  done
done

