#!/usr/bin/perl -w
use strict;
use File::Type;
my $filename = 'myfile.zip';
my $filetype = File::Type->new();
my $type = $filetype->checktype_filename($filename);
my $zipped = ($type eq 'application/zip');
print "$filename is of type $type (", $zipped ? '' : 'not ', "zipped)\
+n";
When you say "zipped" do you mean "compressed" or do you mean that a specific compression algorithm/tool was used (i.e., Windows PKZIP format)?
File::Type can also tell you if the file is compressed in other ways, though you'll have to check the return value for each type.
--
Eric Hammond |