save the following as fstat.c, compile it with "cc -o fstat fstat.c", then run it as "fstat myfile"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <time.h>
int rtn;
struct stat buf_st;
struct tm *tm_st;
main( argc, argv, envp)
int argc;
char **argv, **envp;
{
time_t now;
if( argc != 2 )
{
fprintf( stderr, "Error: number of args\n" );
exit( 1 );
}
rtn = stat( argv[1], &buf_st );
if( rtn != 0 )
{
fprintf( stderr, "stat() return code=%d\n", rtn );
perror( "error text=" );
exit(1);
}
fprintf( stderr, "FILE=%s\n", argv[1] );
fprintf( stderr, "SIZE=%d\n", buf_st.st_size );
fprintf( stderr, "MODE=%d\n", buf_st.st_mode );
tm_st = localtime( &buf_st.st_mtime );
fprintf( stderr, "MTIME=%10.10d -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d ->%s",
buf_st.st_mtime,
tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
ctime( &buf_st.st_mtime ) );
tm_st = localtime( &buf_st.st_atime );
fprintf( stderr, "ATIME=%10.10d -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d ->%s",
buf_st.st_atime,
tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
ctime( &buf_st.st_atime ) );
tm_st = localtime( &buf_st.st_ctime );
fprintf( stderr, "CTIME=%10.10d -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d ->%s",
buf_st.st_ctime,
tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
ctime( &buf_st.st_ctime ) );
time( &now );
tm_st = localtime( &now );
fprintf( stderr, "NOW =%10.10d -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d ->%s",
now,
tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year - 100,
tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
ctime( &now ) );
now = 0;
tm_st = localtime( &now );
fprintf( stderr, "EPOCH=%10.10d -> %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d ->%s",
now,
tm_st->tm_mon + 1, tm_st->tm_mday, tm_st->tm_year,
tm_st->tm_hour, tm_st->tm_min, tm_st->tm_sec,
ctime( &now ) );
}
-----Original Message-----
From: prasad maganti [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 27, 2001 4:11 AM
To: Multiple recipients of list ORACLE-L
Subject: Year of Unix file
Hi dba's
when i list the unix file (solaris), with ls -lt
command , i am able to see the time, month, date that
is created.
is there any way to see the year that is created.
any commands....
prasad.
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: prasad maganti
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
