find /Users/tlialin/desktop/01282016/Test -type f -name "*.html" -exec tidy -f errors.txt -m -utf8 -i {} \; #### use HTML::Tidy; my $call_dir = "Test"; my $contents_of_file = 1; #my $tidy = HTML::Tidy->new(); my $tidy = HTML::Tidy->new({config_file => 'config.txt'}); #my $tidy = HTML::Tidy->new( {config_file => 'path/to/config'} ); my @files = glob "$call_dir/*.html"; printf "Got %d files\n", scalar @files; for my $file (@files) { open my $in_fh, '<', $file or die "Could not open $file : $!"; my $contents_of_file = do { local $/;<$in_fh> }; close $in_fh; $tidy->parse( $file, $contents_of_file ); $tidy->clean( $file); #parse( $filename, $str [, $str...] ) #or warn "Error parsing $file :$!"; for my $message ( $tidy->messages ) { print $message->as_string; } } #### #### output-xhtml: yes add-xml-decl: no doctype: strict char-encoding: ascii indent: auto wrap: 76 repeated-attributes: keep-last error-file: errs.txt