3 # zforce: force a gz extension on all gzip files so that gzip will not
6 # This can be useful for files with names truncated after a file transfer.
7 # 12345678901234 is renamed to 12345678901.gz
9 PATH="/mingw/bin:$PATH"; export PATH
12 echo "force a '.gz' extension on all gzip files"
13 echo usage: $x files...
19 if test ! -f "$i" ; then
20 echo ${x}: $i not a file
24 test `expr "$i" : '.*[.-]z$'` -eq 0 || continue
25 test `expr "$i" : '.*[.-]gz$'` -eq 0 || continue
26 test `expr "$i" : '.*[.]t[ag]z$'` -eq 0 || continue
28 if gzip -l < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
30 if test `expr "$i" : '^............'` -eq 12; then
31 new=`expr "$i" : '\(.*\)...$`.gz
35 if mv "$i" "$new" 2>/dev/null; then
36 echo $i -- replaced with $new
39 res=1; echo ${x}: cannot rename $i to $new