how to check if file is zipped

I have a script that grabs files from directory , zips and moves them somewhere else. It works fine except the case when files it grabs are already zipped. Then it trys to zip it again which does not make sence.

How can I check before zipping if file is already zipped?
thanks in advance

$ file tztest.gz
tztest.gz:      gzip compressed data - deflate method , original file name , max compression

Carl

You can also use the below gzip options to verify that file is compressed.

-l option will give you the details of compression.
-t will check the integrity of the zipped file

You can incorporate the same in the script something like below:

gzip -t file 2>/dev/null
[[ $? -eq 0 ]]&&echo "Compessed file" || echo "Not compressed"

thank you. it worked