#!/bin/csh -f

# Move capture from the local video array to a destination storage array

#check command line
if ( $#argv != 2 ) then 
  echo "Usage: mvgrab <capture_number> <destination_path>";
  exit 1 
endif

#get the command line
set CAPTURE=$argv[1]; #capture number
set DESTPATH=$argv[2]; #destination path

# move
set NUM_VIEWS=`cameras.csh`;
set i=0;
while ($i<$NUM_VIEWS)
  set GRABBER=`cameras.csh $i`;
  set MACHINE=$GRABBER[1];
  set SRCFILE=/video/grab.${i}.${CAPTURE};
  rsh $MACHINE mv ${SRCFILE} $DESTPATH
  rsh $MACHINE mv ${SRCFILE}.log $DESTPATH
  set i=`expr $i + 1`;
end
