#!/bin/csh -f
#
#Script by BAK on cruise jc032 to create symbolic links.
#Modified by BGW for cruise di346
#Modified by CPA to import oxygen files from /Drobo 
#The assumption is that the raw files are named
#in a way that identifies the instrument, eg
# ctd_jc032_001_ctm.cnv
#
#
# The initial foreach command will need to be modified for each cruise.
#cd data
#cd ctd
# modded bak di368
# modded bak jr302 8 jun 2014 to use rsync

cd ~/cruise/data
cd ctd
cd BOTTLE_OXY 

rsync -av legwork/oxygen/oxygen calculation_JR18002_*.xls .

foreach i (`ls oxygen_calculation_JR18002_*.csv`)
#echo $i
set num = `echo $i | awk '{print substr($1,9,3)}'`
set cruise = 'jr16002'
#echo $num

set linkfile = oxy_${cruise}_${num}.csv
#echo $linkfile

if (! -e $linkfile) then
  echo Making link $linkfile for raw file $i
  ln -s $i $linkfile
endif
end