#! /bin/csh
#
#
# Copyright 1990, Performance Systems International Inc.
# Copyright 1988,1989 NYSERNet Inc.
# Copyright 1990, Sony Corp.
# All Rights Reserved
#
source ../../config/report-env
if (-e $ROOT/config/weekly-env) then
  source $ROOT/config/weekly-env
else
  echo "$0 : weekly-env missing. Can't continue. Exit."
  exit(1)
endif

if ($#argv >= 2) then
        set     ext=$argv[1]
        set     destination=$argv[2]
else
        echo "Usage: $0 mmddyy path"
	exit(1)
endif

set datestmp=$destination/dates.tmp
/bin/rm -f $datestmp
/bin/ls $RAWDATASRC | awk '/^[0-1][0-9][0-3][0-9][8-9][0-9]$/ { print }' |\
     $BIN/dateformat yymmdd | sort > $datestmp
tail -7 $datestmp | $BIN/dateformat mmddyy | in1period $ext 7 |\
     $BIN/copyrawdata $destination
/bin/rm -f $datestmp
