#!/usr/bin/perl use strict; use warnings; my @dates = qw(20070202 20070703 20070704); my $datapath = "/p/data/"; foreach my $date (@dates){ if(-e "$datapath/$date"){ opendir(THISDIR, "$datapath/$date") || die("Cannot read dir $datapath/$date"); my @files_list = grep(/^ABB.*/, readdir(THISDIR)); closedir THISDIR; print OUT "$datapath/$date COUNT:". scalar(@files_list) ."\n"; foreach my $file(@files_list) { if (-e "$datapath/$date/$file/HDR_FILE"){ open(DATA, "$datapath/$date/$file/HDR_FILE") ; my $content=""; while() { if( (/Subject/ .. ( eof() ) ) { $content .= $_; } } close DATA; my $hex = md5_hex($content); if(!$hex || !$content) { print "Could not generate MD5 : $file \n"; next; } } else { print "No HDR_FILE Found, skipp \n"; } } }