#!/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
cd cruise/data
cd ctd
cd BOTTLE_OXY 

#rsync -av jcrfs_oxy/* .



foreach i (`ls unc/JR302OXY???.csv`)
#echo $i
set num = `echo $i | awk '{print substr($1,13,3)}'`
set cruise = 'jr302'
#echo $num

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

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