Operating System - HP-UX
1825793 Members
2344 Online
109687 Solutions
New Discussion

How to know the modification seconds of a file ?

 
SOLVED
Go to solution
Olivier Decorse
Respected Contributor

How to know the modification seconds of a file ?

Hello,
Under HP-UX 11.00, i'm trying to find the last modification time of a file, with the precision of the second.
I know that "ls -l" give that time, but i just can read hour/minute : i don't have any information about second. I think that HP-UX manage file with seconds, but don't know how to display this information.
Is there any solution or tool to do that ?
Thank you in advance.
Olivier.
They say "install windows 2k, xp or better", so i install unix !
4 REPLIES 4
Solution

Re: How to know the modification seconds of a file ?

Get a copy of GNU core utils, and you will find a version of ls that will allow you to format the date output as you require:

http://hpux.connect.org.uk/hppd/hpux/Gnu/coreutils-5.2.0/

HTH

Duncan

I am an HPE Employee
Accept or Kudo
harry d brown jr
Honored Contributor

Re: How to know the modification seconds of a file ?

Try this perl:

#!/usr/bin/perl
#
$filename=@ARGV[0];
(($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blk
size,$blocks) = lstat($filename));
printf("atime is %d\n",$atime);
printf("mtime is %d\n",$mtime);
printf("ctime is %d\n",$ctime);
printf("Name is %s\n",$filename);


live free or die
harry
Live Free or Die
Olivier Decorse
Respected Contributor

Re: How to know the modification seconds of a file ?

Thank you, Duncan : the ls command from the coreutils displays time with seconds, if we use the --full-time option.

And thank you, harry : your perl script shows effectively the time in second from 1 jan 1970. We just have to convert it to the real time ...

Olivier.
They say "install windows 2k, xp or better", so i install unix !
Olivier Decorse
Respected Contributor

Re: How to know the modification seconds of a file ?

Closed ... with THE solution !!!
Olivier.
They say "install windows 2k, xp or better", so i install unix !