#! /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

set dest=$argv[1]
set nonomatch
set date = $<
while ($date != "")
  foreach file ($RAWDATASRC/$date/*-*)
    if ("$file:t" == '*-*') then
      break
    endif
    if (-z $file) then
      continue
    endif
    set ff=$file:t
    if ($ff:e == Z) then
      if (-e ${dest}/${ff:r}) then 
        zcat $RAWDATASRC/$date/$ff >> ${dest}/${ff:r}
      else
        zcat $RAWDATASRC/$date/$ff > ${dest}/${ff:r}
      endif
    else
      if (-e ${dest}/${ff}) then 
        cat $RAWDATASRC/$date/$ff >> ${dest}/${ff}
      else
        cat $RAWDATASRC/$date/$ff > ${dest}/${ff}
      endif
    endif
  end
  set date = $<
end
unset nonomatch
exit
