in reply to Re: testing for a zip file
in thread testing for a zip file

Aren't you assuming a specific tool was used to do the zipping, though? Or, is that a universal standard?

Try this (requires the Archive::Zip module):

use Archive::Zip; $zip = Archive::Zip->new(); die "Invalid zip file!" if $zip->read("zipfile.zip") != AZ_OK;
Update:You may need some of the other Archive modules if you want to check for gzipped files.

Replies are listed 'Best First'.
Re: Re: Re: testing for a zip file
by tcf22 (Priest) on Aug 29, 2003 at 14:33 UTC
    As far as I know all Windows/DOS based .ZIP archives start with PK. This however is not the case for gzip(.gz) files.