#!/bin/bash #+ # NAME: # nv3nson_align # PURPOSE: # This will align the number of nv3 files to nson files in # the $DAT/nagoya/*/raw directories # so that they can be read in by the image creation routines, which require that the count # of each match. # CALLING SEQUENCE: # nv3nson_align # INPUTS; # prefix either 'nv3h' or 'n3d' # nv3h: process nv3h files in $DAT/nagoya/fast/raw # nv3d: process nv3d files in $DAT/nagoya/slow/raw # PROCEDURE: # nv3h/nv3d files without a matching nson file are moved to # a subdirectory 'ice'. # nson files without a matching nv3h/nv3d file are deleted. #- . tiny_bits.sh __CALLER__=`basename $0` __TIME_TAG__="%m/%d %H:%M" prefix=$1 if [ -z "$prefix" ] || [ "$prefix" != "nv3d" -a "$prefix" != "nv3h" ]; then tiny_die "specify either 'nv3h' or 'nv3d'" fi declare -A BASEDIR BASEDIR=( [nv3d]=slow [nv3h]=fast ) rawdir="$NAGOYA/${BASEDIR[$prefix]}/raw" nicedir="$rawdir/nice" if [ $prefix = 'nv3d' ]; then rawdir+="/transit" fi tiny_say "align $prefix and nson files in $rawdir" ls $rawdir/nson* 2> /dev/null | while read f; do # Loop over nson files g=`basename $f` g="$rawdir/${g/nson/$prefix}" if [ ! -f $g ]; then # No matching nv3d file rm -v $f # Remove nson file fi done if [ `ls $rawdir/nson* 2> /dev/null | wc -l` -ne 0 ]; then ls $rawdir/$prefix* 2> /dev/null | while read f; do # Loop over nv3d files g=`basename $f` g="$rawdir/${g/$prefix/nson}" if [ ! -f $g ]; then # No matching nson file mv -v $f $nicedir # Move to 'ice' subdir fi done fi exit 0