in reply to Error in script

If you're already going to write a Perl script, why shelling out? Do it all in Perl - or does speed matter that much?

use strict; use warnings; use File::Find; my @start_dirs = qw(/home/bob/mytemp); sub rm_empty_file { my $file = $File::Find::name; if ( -f $file and -z $file ) { print "removing empty file: $file\n"; #TODO: unlink $file or die "cannot remove $file - $!"; } } find( { wanted => \&rm_empty_file, no_chdir => 1 }, @start_dirs );