File indexing completed on 2026-04-09 07:49:03
0001
0002 usage(){ cat << EOU
0003 tmp_grab.sh
0004 =============
0005
0006 This has become too organic, so moving to tmpgrab.sh
0007
0008 EOU
0009 }
0010
0011
0012
0013 source $PWD/../bin/GEOM.sh trim
0014
0015 arg=${1:-all}
0016 shift
0017
0018 msg="=== $BASH_SOURCE :"
0019 executable=GeoChain
0020 EXECUTABLE=${EXECUTABLE:-$executable}
0021 xdir=/tmp/blyth/opticks/$EXECUTABLE/$GEOM/
0022
0023
0024
0025 from=P:$xdir
0026 to=$xdir
0027
0028 LOGDIR=/tmp/$USER/opticks/CSGOptiX/CSGOptiXSimtraceTest
0029
0030
0031 printf "arg %s ( the possibilities are : png jpg mp4 all ) \n" "$arg"
0032 printf "EXECUTABLE %s \n " "$EXECUTABLE"
0033 printf "\n"
0034 printf "xdir %s \n" "$xdir"
0035 printf "from %s \n" "$from"
0036 printf "to %s \n" "$to"
0037
0038 mkdir -p $to
0039
0040
0041 grab_typ(){
0042 local typ=${1:-png}
0043
0044 rsync -zarv --progress --include="*/" --include="*.$typ" --include="*.json" --exclude="*" "$from" "$to"
0045 local typfind=$(find ${to%/} -name "*.$typ")
0046
0047 if [ -n "$typfind" ]; then
0048 ls -1rt $typfind
0049 local last=$(ls -1rt $typfind | tail -1 )
0050 echo $msg typ $typ last $last
0051 if [ "$(uname)" == "Darwin" ]; then
0052 open $last
0053 fi
0054 else
0055 echo $msg failed to find $typ
0056 fi
0057 }
0058
0059 grab_all()
0060 {
0061 rsync -zarv --progress --include="*/" --include="*.txt" --include="*.npy" --include="*.jpg" --include="*.mp4" --include "*.json" --exclude="*" "$from" "$to"
0062 ls -1rt `find ${to%/} -name '*.json' -o -name '*.txt' `
0063 ls -1rt `find ${to%/} -name '*.jpg' -o -name '*.mp4' -o -name '*.npy' `
0064
0065 local all_npy=$(find ${to%/} -name '*.npy')
0066
0067 if [ -n "$all_npy" ]; then
0068
0069 local last_npy=$(ls -1rt $all_npy | tail -1 )
0070 local last_outdir=$(dirname $last_npy)
0071
0072 if [ ! -d "$LOGDIR" ]; then
0073 echo $msg creating LOGDIR $LOGDIR
0074 mkdir -p $LOGDIR
0075 fi
0076
0077 if [ -d "$LOGDIR" ]; then
0078 local script=$LOGDIR/CSGOptiXSimtraceTest_OUTPUT_DIR.sh
0079 printf "export CSGOptiXSimtraceTest_OUTPUT_DIR=$last_outdir\n" > $script
0080 echo $msg script $script
0081 cat $script
0082 else
0083 echo $msg LOGDIR $LOGDIR does not exist : cannot write CSGOptiXSimtraceTest_OUTPUT_DIR.sh based on last_outdir $last_outdir : use arg like jpg to grab renders only
0084 fi
0085
0086 fi
0087
0088 }
0089
0090
0091 echo
0092 read -p "$msg Enter YES to proceed with rsync grab from remote : " ans
0093 if [ "$ans" == "YES" ]; then
0094 echo $msg PROCEEDING
0095 else
0096 echo $msg SKIPPING : perhaps you should use cxs_grab.sh or another script ?
0097 exit 1
0098 fi
0099
0100
0101 case $arg in
0102 png) grab_typ png ;;
0103 jpg) grab_typ jpg ;;
0104 mp4) grab_typ mp4 ;;
0105 all) grab_all ;;
0106 esac
0107
0108