#!/bin/bash # # script to move the NXT files that we care about from # one location to the current working directory, and create # symbolic links in their place at the original location # # hand-coded NXT files are placed in the "private" subdirectory # of the current working directory, which should already have # been created before this script is run. # # usage: # ./grab-nxt-files expt orig-location # example: # ./grab-nxt-files jcte1 /group/project/jast/NXT/jcte1/codings # # Tim Taylor, 15 April 2009 if [ ! -d private ]; then echo "Must create private subdirectory before calling this script!" exit fi E=$1 D=$2 C=`pwd` for N in 1 2; do for A in 0 1 2 3 4 5 6 7 8 9; do for B in 0 1 2 3 4 5 6 7 8 9; do if [ -e $D"/"$E"_"$A$B"_P"$N".trials.xml" ]; then echo "$A$B" # first look for the per-participant (a/b) files for P in a b; do # look for the xml files generated directly from GDF, with no hand-coding for T in blinks fixations mouse-actions object-hovers object-looks part-hovers part-looks region-hovers region-looks saccades; do if [ -e $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" ]; then cp $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" . rm -f $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" ln -s $C/$E"_"$A$B"_P"$N"."$P"."$T".xml" $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" fi done # look for then hand-coded files for T in segments words nees; do if [ -e $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" ]; then cp $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" private/$E"_"$A$B"_P"$N"."$P"."$T".xml" rm -f $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" ln -s $C/private/$E"_"$A$B"_P"$N"."$P"."$T".xml" $D"/"$E"_"$A$B"_P"$N"."$P"."$T".xml" fi done done # now look for the remaining per-trial files # look for the xml files generated directly from GDF, with no hand-coding for T in breaks construction-phases docking screen-objects trials; do if [ -e $D"/"$E"_"$A$B"_P"$N"."$T".xml" ]; then cp $D"/"$E"_"$A$B"_P"$N"."$T".xml" . rm -f $D"/"$E"_"$A$B"_P"$N"."$T".xml" ln -s $C/$E"_"$A$B"_P"$N"."$T".xml" $D"/"$E"_"$A$B"_P"$N"."$T".xml" fi done # look for then hand-coded files for T in nees; do if [ -e $D"/"$E"_"$A$B"_P"$N"."$T".xml" ]; then cp $D"/"$E"_"$A$B"_P"$N"."$T".xml" private/$E"_"$A$B"_P"$N"."$T".xml" rm -f $D"/"$E"_"$A$B"_P"$N"."$T".xml" ln -s $C/private/$E"_"$A$B"_P"$N"."$T".xml" $D"/"$E"_"$A$B"_P"$N"."$T".xml" fi done fi done done done # finally, move any other experiment-wide files of interest for F in experiments.xml ne-types.xml ref-types.xml; do if [ -e $D/$F ]; then cp $D/$F . rm -f $D/$F ln -s $C/$F $D/$F fi done # and make sure permissions/ownership of new files is right chown -R timt:jast * chmod go-w private chmod o-r private