unzip particular gzip files among the normal data files

Hello experts,

I run Solaris 9. I have a below script which is used for gunzip the thousand files from a directory.
----
#!/usr/bin/sh
cd /home/thousands/gzipfiles/
for i in `ls -1`
do
gunzip -c $i > /path/to/file/$i
done
----
In my SAME directory there thousand of GZIP file and also thousands of data files(already been unzipped) with same name unixtt*

bash-2.05$ file unixtt01674
unixtt01674: data

bash-2.05$ file unixtt01677
unixtt01677: gzip compressed data - deflate method

Is it possible I can just unzip only GZIP unixtt* files leaving the data unixtt* files.?? What should i need to add in the script ??

//purple

Firstly sort out your naming conventions so files that are compressed do have an extension indicating the compression method, eg .Z, .gz etc.

If "file" can tell you what is a gzipped file, then use that to tell you in the script.

my GZIP Files have no extension. its just appear without extension. So, litterally just to see the files it is not possible which one is data and which one is Gzip.

Please provide me the coding lines how to define "file" in script....

I suggest you review that strategy.

something like

file $somefile | grep "gzip compressed data"
if test "$?" = "0"
then
    echo $somefile is gzipped
fi

hi guys,

Below is worked for me. Thanks buddies for the hints--
#!/usr/bin/sh
cd /thousand/files/
for i in `ls`
do
l=`file $i|grep gzip|wc -l`

if [ $l -ne 0 ]; then
gunzip -c $i > /path/to/file/$i
fi
done