---8<---
-
Using
my $filename = "$test";
my $mtime = (stat $filename)[9]; # or ctime is 10
my $time = time; # broke time out to print
my $age = int (($time - $mtime) / 86400); # did int to drop fraction
print "time=$time, mti
Ah hah! I removed the file::stat and it worked like a charm! Awesome!
Thanks,
John
> [EMAIL PROTECTED] wrote:
> > Using
> >
> > my $filename = "$test";
> > my $mtime = (stat $filename)[9]; # or ctime is 10
> > my $time = time; # broke time out to print
> > my $age = int (($time - $mtime) / 86400
[EMAIL PROTECTED] wrote:
> Using
>
> my $filename = "$test";
> my $mtime = (stat $filename)[9]; # or ctime is 10
> my $time = time; # broke time out to print
> my $age = int (($time - $mtime) / 86400); # did int to drop fraction
> print "time=$time, mtime=$mtime, age=$age\n";
>
> I get the follo
Using
my $filename = "$test";
my $mtime = (stat $filename)[9]; # or ctime is 10
my $time = time; # broke time out to print
my $age = int (($time - $mtime) / 86400); # did int to drop fraction
print "time=$time, mtime=$mtime, age=$age\n";
I get the following results:
time=1031216545 mtime= age=11
[EMAIL PROTECTED] wrote:
> Well its not much different than what was posted below, here it is :
>
> my $ctime = (stat $test)[10]; # or mtime is 9
> my $age = (time - $ctime) / 86400;
>
> The file date is Sep 2 07:46 and this code tells me it is 11935.3388425926
> days old!?
The display time is
Well its not much different than what was posted below, here it is :
my $ctime = (stat $test)[10]; # or mtime is 9
my $age = (time - $ctime) / 86400;
The file date is Sep 2 07:46 and this code tells me it is 11935.3388425926
days old!?
Thanks,
John
>
> Hello,
>
> Thanks for the code below. W
[EMAIL PROTECTED] wrote:
> Hello,
>
> Thanks for the code below. When I implement this I still get a number like
> 11935.3388425926 but the file is not 11935 days old its date is Sep 2 07:46
> Am I missing something here? BTW I switched to mtime [9] as I want the
> creation of last modified not
Hello,
Thanks for the code below. When I implement this I still get a number like
11935.3388425926 but the file is not 11935 days old its date is Sep 2 07:46
Am I missing something here? BTW I switched to mtime [9] as I want the
creation of last modified not accessed.
Thanks,
John
> [EMAIL P
[EMAIL PROTECTED] wrote:
> Hello,
>
> I am looking to find out the age of a file in days, what is the best way to
> do this using perl and maby file:stat or something? I have tried but get
> some outrageous number in the millions!?
Untested:
my $ctime = (stat $filename)[10]; # or mtime