On 21 Feb 2004, at 19:03, John wrote:


I want to test if a file is a gif image or not.

Is it practicable using a module?

perldoc File::MMagic


#!/usr/bin/perl -w

use strict;

die "Usage: $0 directory\n" unless @ARGV > 0;

use File::Find;
use File::MMagic;

my $mm = File::MMagic->new;
find sub {
    return if -d $_ or -l $_;
    my $type = $mm->checktype_filename($_);
    return unless $type =~ /gif/i;
    print "$File::Find::name: $type\n";
}, @ARGV;

I just happen to be reading an excellent series of articles by Randal ... You should read them as well...

http://www.google.com/search? site=swr&q=site%3Astonehenge.com&as_q=File%3A%3AFind&btnG=Search+stonehe nge.com+with+Google

Jerry



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to