#!/bin/sh
#$Id$
#
#  Example:
#     copy-proc-to-proc grid.dat ../hydro256e
#     copy-proc-to-proc seed.dat ../hydro256e
#     copy-proc-to-proc dim.dat ../hydro256e

#  will copy all var.dat files fron current directory to var.dat in
#  another run directory.
#  An optional 3rd argument ($fromdir) can be give as soure directory
#  Used for restarting in a different directory.
#  Target dir tree needs to exist already.

if [ $# -eq 3 ]; then
  fromdir=$3
else
  fromdir='.'
fi

procdirs=`\ls data | grep proc `
for proc in $procdirs
do
  echo "cp data/$proc/$1 $2/data/$proc/"
  cp $fromdir/data/$proc/$1 $2/data/$proc/
done
