ls -e to find out File modification time in secs

Hi All,

I would like to know the file modification time till seconds in Unix. So I tried ls -e and it worked fine. This Solaris 5.10

-rw-rw-r-- 1 test admin 22 Sep 12 11:01:37 2008 test_message

But I am not able to run the same command in SOlaris 5.6 and also in AIX/HP
Is there any other command on those OS and versions.

any help pointer will be of great help.

Regards.

I'm not sure about HPs and older Sun, but I think that your last resort may be to build a perl wrapper around the stat function.
Hope this works, I haven't tested it myself.

try:

perl -e '$mtime=(stat("filename"))[9]; $cur_time=time();  print $cur_time - $mtime;'

Thanks a lot for ur help. stat function is working perfectly fine

use File::stat;
$sb = stat($filename);
printf "File is %s, size is %s, perm %04o, mtime %s\n",
$filename, $sb->size, $sb->mode & 07777,
scalar localtime $sb->mtime; use File::stat;
$sb = stat($filename);
printf "File is %s, size is %s, perm %04o, mtime %s\n",
$filename, $sb->size, $sb->mode & 07777,
scalar localtime $sb->mtime;

Have not tried the version from dennis. will try.

But can't be get those parameters from Unix shell.
I mean even if not in seconds just the ctime, mtime and atime

Regards,