use strict; use warnings; use File::stat; use Time::localtime; use RTF::Tokenizer; require Win32::OLE; sub get_data_from_file ; my $fullpath = my $dir = 'C:\Test'; my %hash; opendir (DIR, $dir) or die $!; while (my $dir = readdir(DIR)) { my $file = $fullpath = 'C:\Test\\' . $dir; opendir (FILE, $file) or die $!; while (my $file = readdir(FILE)) { if ($file =~/RTF/ || $file =~/rtf/ ){ # if ( $file =~/txt/ ){ # print "fullpath = $fullpath file is $file\n"; # $hash{$dir}{$file}{PATH} = $fullpath . '\\' . $file; my $upload_date = ctime(stat($fullpath . '\\' . $file)->mtime); $hash{$dir}{$file}{UPLOAD_DATE} = $upload_date; # print "dir is $dir file is $file date is $hash{$dir}{$file}{UPLOAD_DATE}\n"; # print $hash{$dir}{$file}{PATH}; open (IN, $fullpath . '\\' . $file) or die ("Can't open the input file $!"); while ( ){ # Try to find date on this line "Document Owner: Date of Last Update: 10/15/2013 #print $_; chomp; if( m/Date of Last Update:(.*)/) { print $1; next; } # Count the number of signature lines } close (IN); } } #print "dir is $dir\n"; } closedir(DIR); closedir(FILE); #print_data (\%hash); sub print_data { my ($h_ref) = @_; foreach my $dir (keys %$h_ref){ foreach my $file (keys $h_ref->{$dir}){ print "$dir, $file, $h_ref->{$dir}{$file}{UPLOAD_DATE}\n"; } } }