#!perl use strict; use warnings use autodie; # errors with open, chdir, etc are now fatal use File::Find::Rule; use File::DosGlob 'glob'; my $search = shift || 'c:/Documents and Settings/user/Desktop/newbatch2' ; my $outfile = 'c:/Documents and Settings/user/Desktop/newbatch/log.txt'; open my $outf, '>', $outfile; for my $dir (File::Find::Rule->dir->in($search)) { for my $file ( <*>) { my $path = "$dir\\$_"; print " $path\n"; if (-f $path) { if ($file ne 'empty.txt' and $file ne 'sample.txt') { unless (-s $path) { print $outf "Warning: $path has size ZERO\n"; } } } } }