#!/usr/bin/perl use File::Find; $|++; my $path = '.'; my $cmd = 'file'; finddepth (\&wanted,$path); # untested regex my $regex = qr/\Q.png$\E/i; sub wanted { return unless -f; #-d for dir ops or comment out for both if ( /$regex/) { print "$File::Find::name\n" #do your ImageMagick processing here } } __END__