Returning file modified time as Blank -- why?? (156 Views)
Occasional Contributor
Puneet Bhatia_1
Posts: 2
Registered: ‎01-26-2011
Message 1 of 1 (156 Views)

Returning file modified time as Blank -- why??

I am trying to find the difference of system time and file last modified time(current_mtime -> calculated through stat command) for the searched files . But it is returning mtime as Blank(null value)for each searched files. Please help me, where i am making the mistake in this script

my $dir_path;
my $cmd;
my $buf;
use strict;
use File::Find;
use File::stat;
my $current_mtime;

$cmd="ll $dir_path > result";

my @temp;
push @temp , split(/\s+/,$buf);
if ( $temp[8] =~ m/^mdc/i )
# Printing filename , Time and Date
print "\nFile $temp[8] last modified on $temp[7] $temp[6]\n";

find(\&syswanted, '$temp[8]');

# $now is current system unix time
my $now;
$now=`date '+%s'`;
print "\n Now : $now \n";
my $t;

#print "MTime: $current_mtime\n";

print " Diff in minutes is: $t \n\n";


sub syswanted

my $file = $_;
print "File: $file\n";

$current_mtime = (stat($file))[8];
print "MTime: $current_mtime\n";


Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation