2014년 3월 7일 금요일

[perl] 이미지가로 500px 작으면 삭제

use strict;
#use warnings;
use Cwd;

use File::Find;
use Image::Size;

if (@ARGV <1){
print "Useage: $0 [string to search] [file type]\n";
exit 1;
}
 opendir (DIR, $ARGV[0]) or die $!;
   
    my @list;
chdir($ARGV[0]);   
  while (my $file = readdir(DIR)) {

   my ($width, $height ) = imgsize($file);
       
   #print $width;
    if ($width < 500) {
    push(@list,$file);
    }

    }
   
unlink @list;

댓글 없음:

댓글 쓰기