#!/usr/bin/perl use Shell qw(convert gocr); my $dirname = "/Users/joe/Documents/SecWork/ocr/"; opendir(DIR, $dirname) or die "can't opendir $dirname: $!"; while ($file = readdir(DIR)) { convert($dirname . $file . ' -compress none -colorspace rgb -contrast -gamma 0.3 ' . $dirname . $file); gocr(' -p ./tmpdb/ -m 256 -m 130 -a 98 -d 0 -C "1234567890abcdefghijklmnopqvwxyz@._-" ' . $dirname . $file); } closedir(DIR);