[Sunhelp] EXACT!!! creation time of files

Doug McLaren dougmc at frenzy.com
Tue Aug 31 10:29:02 CDT 1999


On Tue, Aug 31, 1999 at 10:59:40AM -0400, Wolfgang Engelien wrote:

| It is very kind of you to say that, but it
| would be even more kind to tell me the EXACT
| COMMAND, WHICH YOU HAVE TESTED BEFOR. Any ls
| command I tried does not give me an EXACT
| time as I have mentioned it. Here again,
| 
| I want to be able to say for example:
| File X was created in December 6th 1998 14:05:45
| 	or
| file X was created 882988997 SECONDS after January 1st 1970.

Obviously you've missed two things -

1) obviously, accurate to the second is not EXACT.
2) the number that you get is not guaranteed to be the creation time -
   just that it often is.  And it's the best/only number that's available.

That being said, here is the EXACT COMMAND, WHICH HAS BEEN TESTED
BEFORE!

   % perl -e '$c=(stat "/etc/hosts")[10] ; print "$c\n"'
   935730232

   % perl -e '$c= scalar localtime( (stat "/etc/hosts")[10]) ; print "$c\n"'
   Fri Aug 27 00:03:52 1999

And if you don't have perl, get it.

-- 
Doug McLaren, dougmc at frenzy.com






More information about the SunHELP mailing list