#!/bin/bash

# Usage: upload yy ddd stations.txt magicuser.cfg [hourly]
#
# RINEX files are deleted from the current directory!

yy=$1
ddd=$2
stations=$3
magicuser=$4
hourly=$5

for station in `cat $stations`
do

if [ "$hourly" = hourly ]
then

for hour in `cat hours.txt`
do

hourn=`echo $hour | cut -c1-2`
hourl=`echo $hour | cut -c3-3`

file="$station"$ddd"$hourl."$yy"d.Z"

ncftpput -f $magicuser . $file

rm -f $file

done

else

file="$station"$ddd"0."$yy"d.Z"

ncftpput -f $magicuser . $file

rm -f $file

fi

done

