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. 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 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 is 9
> > my $age = (time - $ctime) / 86400;
> >
> > --
> >    ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
> >   (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
> >    / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for
Perl)
> > -/-' /___/_<_</_</_     Castle of Medieval Myth & Magic
> http://www.todbe.com/
> >
> > _______________________________________________
> > Perl-Unix-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
>
> _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to