| 28 |
INDIR="/u/edhill/Mail/MITgcm-test" |
INDIR="/u/edhill/Mail/MITgcm-test" |
| 29 |
OUTDIR= |
OUTDIR= |
| 30 |
TEMPDIR=./ptmp |
TEMPDIR=./ptmp |
| 31 |
MUNPACK=munpack |
MUNPACK=/u/edhill/local/bin/munpack |
| 32 |
|
|
| 33 |
# Parse options |
# Parse options |
| 34 |
ac_prev= |
ac_prev= |
| 83 |
echo "ERROR: directory \"$OUTDIR\" doesn't exist and can't be created" |
echo "ERROR: directory \"$OUTDIR\" doesn't exist and can't be created" |
| 84 |
exit 1 |
exit 1 |
| 85 |
fi |
fi |
| 86 |
|
chgrp gcmpack $OUTDIR |
| 87 |
|
chmod 775 $OUTDIR |
| 88 |
fi |
fi |
| 89 |
|
|
| 90 |
echo "Using OUTDIR=\"$OUTDIR\"" |
echo "Using OUTDIR=\"$OUTDIR\"" |
| 96 |
for file in $all_files ; do |
for file in $all_files ; do |
| 97 |
|
|
| 98 |
# create local copy |
# create local copy |
| 99 |
rm -rf $TEMPDIR |
test -e $TEMPDIR && rm -rf $TEMPDIR |
| 100 |
mkdir $TEMPDIR |
mkdir $TEMPDIR |
| 101 |
cp $INDIR"/"$file $TEMPDIR |
cp $INDIR"/"$file $TEMPDIR |
| 102 |
|
|
| 120 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
| 121 |
continue |
continue |
| 122 |
fi |
fi |
| 123 |
tdir=`cat $TEMPDIR"/out" | head -1 | cut -d '/' -f 1` |
tdir=`cat $TEMPDIR"/out" | head -1 | sed -e 's|^./||g' | cut -d '/' -f 1` |
| 124 |
rm -f $TEMPDIR"/out" |
rm -f $TEMPDIR"/out" |
| 125 |
|
|
| 126 |
# copy to $OUTDIR and rename if necessary |
# copy to $OUTDIR and rename if necessary |
| 129 |
while test -e $OUTDIR"/"$tdir"_"$ad ; do |
while test -e $OUTDIR"/"$tdir"_"$ad ; do |
| 130 |
ad=$(( $ad + 1 )) |
ad=$(( $ad + 1 )) |
| 131 |
done |
done |
| 132 |
mv $TEMPDIR"/"$tdir $OUTDIR"/"$tdir"_"$ad |
mv $TEMPDIR"/"$tdir $OUTDIR"/"$tdir"_"$ad > /dev/null 2>&1 |
| 133 |
|
chmod -R a+rx $OUTDIR"/"$tdir"_"$ad > /dev/null 2>&1 |
| 134 |
|
gzip $OUTDIR"/"$tdir"_"$ad"/output.txt" |
| 135 |
else |
else |
| 136 |
mv $TEMPDIR"/"$tdir $OUTDIR |
mv $TEMPDIR"/"$tdir $OUTDIR > /dev/null 2>&1 |
| 137 |
fi |
chmod -R a+rx $OUTDIR"/"$tdir > /dev/null 2>&1 |
|
|
|
|
# If it exists, gzip the "output.txt" file. |
|
|
if test -r $OUTDIR"/"$tdir"/output.txt" ; then |
|
| 138 |
gzip $OUTDIR"/"$tdir"/output.txt" |
gzip $OUTDIR"/"$tdir"/output.txt" |
| 139 |
fi |
fi |
| 140 |
|
|
| 144 |
done |
done |
| 145 |
echo " done" |
echo " done" |
| 146 |
|
|
| 147 |
echo -n "gzipping all the \"output.txt\" files ..." |
# echo -n "gzipping all the \"output.txt\" files ..." |
| 148 |
( |
# ( |
| 149 |
cd $OUTDIR |
# cd $OUTDIR |
| 150 |
outp=`find . -name output.txt` |
# outp=`find . -name output.txt` |
| 151 |
if test "x$outp" != x ; then |
# if test "x$outp" != x ; then |
| 152 |
gzip $outp |
# gzip $outp |
| 153 |
fi |
# fi |
| 154 |
) |
# ) |
| 155 |
echo " done" |
# echo " done" |
| 156 |
|
|
| 157 |
echo -n "setting permissions to world-readable ..." |
# echo -n "setting permissions to world-readable ..." |
| 158 |
chmod -R a+rx $OUTDIR |
# chmod -R a+rx $OUTDIR > /dev/null 2>&1 |
| 159 |
echo " done" |
# echo " done" |
| 160 |
|
|
| 161 |
|
|