#!/usr/bin/perl
use warnings; # use strict; use File::Find; use File::Remove qw(remove); use Image::Info qw(image_info); use File::Scan;
# File::Find wanted function sub wanted;
# variables our ( $file, $dir ); *file = *File::Find::name; *dir = *File::Find::dir;
print "Where are the pictures/?"; chomp( my $indir = <STDIN> );
File::Find::find(\&wanted, '$indir'); exit;
sub wanted {
unless ($file =~ /\.jpg\z/ or
$file =~ /\.tif\z/ or
$file =~ /\.bmp\z/ or
$file =~ /\.png\z/ ) { # delete every file exept
listed image types.
remove $file;
}
else {
my $info = image_info(\$file); # the attributes of
the image file
$type = $info->(file_ext); # three letter image type
$w = $info->(width); # pixel width
$h = $info->(height); # pixel height
$color = $info->(color_type) # color type
# delete small images
if( ($w < 200 and $h < 400) or ($w < 400 and $h < 200) ) {
remove $file;
}
# delete images that try to be a different type from what they say
if ($type ne 'bmp' or
$type ne 'jpg' or
$type ne 'png' or
$type ne 'tif') {
remove $file;
}
# delete all gray scale images
if ($color ne 'Gray' or
$color ne'GrayA') {
remove $file;
}
# check images for viruses
if ($scanres->scan(\$file) ) {
if( $scanres->suspicious) {
print "$file looks like it has a virus, delete/?
/(Y//N/)";
remove $file if <STDIN> =~ /y|Y/;
}
}
}
}..... and the errors:
Unquoted string "width" may clash with future reserved word at ./bigimg2.pl line 35.
Unquoted string "height" may clash with future reserved word at ./bigimg2.pl line 36.
syntax error at ./bigimg2.pl line 39, near ") {"
syntax error at ./bigimg2.pl line 62, near "}"
Execution of ./bigimg2.pl aborted due to compilation errors.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
