#!/bin/csh -f
#
# bak in Amsterdam before start of jc184 uhdas trial
# 3 July 2019
#
# 1) rsync uhdas data from uhdas server to local machine directory atsea
#
# 2) ensure postprocessing directories exist
#
# If the script hasn't been run recently, there will 
# be a lot of files to sync across. The processing on the uhdas
# server updates plenty of things in routine processing every few minutes.
# If the script is then immediately run again, there will be a few files
# that are updated every ping.
#
# List of cruise segments to be processed is found in
# ~/cruise/data/vmadcp/cruise_segments

set rdir = ~/mounts/uhdas_data
set ldir = ~/cruise/data/vmadcp

mkdir -p ${ldir}/atsea
mkdir -p ${ldir}/postprocessing
mkdir -p ${ldir}/atsea/os75
mkdir -p ${ldir}/postprocessing/os75

#foreach i (`cat ~/cruise/raw/os75`)
echo syncing ${i} to ${ldir}
rsync -auv ${rdir}/${i}/*.raw ${ldir}/atsea/os75

#mkdir -p ${ldir}/postprocessing/${i}/proc_editing
#mkdir -p ${ldir}/postprocessing/${i}/proc_archive
#end

mkdir -p ${ldir}/atsea/os150
mkdir -p ${ldir}/postprocessing/os150

#foreach i (`cat ~/cruise/raw/os150`)
echo syncing ${i} to ${ldir}
rsync -auv ${rdir}/${i}/*.raw ${ldir}/atsea/os150

#mkdir -p ${ldir}/postprocessing/${i}/proc_editing
#mkdir -p ${ldir}/postprocessing/${i}/proc_archive
#end

echo end of syncing ${i} to ${ldir}