Sunday, March 30, 2008

Script to convert .z to .Z

#!/bin/sh

#Convert the last letter .z to .Z.
#In Solaris 10 X86, when use -o foldcase to mount FAT32, all uppercase
#letters appear lowercase. And all directories will be shown in
#UPPERCASE if this keyword is not present.
#A solaris bug??

#

#files=`find "/data0/igs0/pub/products" -name "*.z"`
year=1992
while [ $year -le 2000 ]; do
files=`find "/data0/igs0/pub/rinex/${year}" -name "*.z"`
for file in $files; do
ofile=`echo $file | awk '{print substr($0,1,index($0,".z"))"Z"}'`
#echo $ofile
#echo $file
echo "mv $file $ofile"
mv $file $ofile
done
year=`expr $year + 1`
done

No comments: