#!/usr/bin/perl -wT use strict; use File::Find; undef %ENV; &find(\&wanted,'/some/path/stuff'); print "all done\n"; exit(1); ## s u b l a n d sub wanted { my $fn = $_; # filename if ( -f $fn) # it's a file { if ( /somepattern/ and /somepattern/ and not /somepatter/) { printf "unlinking $fn (1 == success) ... %s\n", unlink $fn; } } }