Operating System - HP-UX
1819830 Members
2859 Online
109607 Solutions
New Discussion юеВ

Re: How to get created date/time of a file?

 
Ian lee
Advisor

How to get created date/time of a file?

I want to know some file's created date/time,could sombody tell me that?

thanks.


Ian lee
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: How to get created date/time of a file?

No matter what anyone tries to tell you, if you know the creation time of a file in UNIX, you only know it by accident --- unless the file itself records it as part of the data. The inode has 3 timestamps 1) mtime - time of last data modification 2) atime - time of last access 3) ctime -- time of last metadata change (chmod, chown).

Ctime MIGHT also be the time of file creation but if it is, it's simply coincidence and cannot be trusted. UNIX simply doesn't carry that metadata.
If it ain't broke, I can fix that.
Muthukumar_5
Honored Contributor

Re: How to get created date/time of a file?

UNIX is not carrying out file creation time. We can know modification, changed, access time. However, we can not specifically find creation time in *NIX.

hth.
Easy to suggest when don't know about the problem!
Rajesh SB
Esteemed Contributor

Re: How to get created date/time of a file?

Hi,

"ls" command with -c option gives some info like.

-c Use time of last modification of the inode (file created, mode changed, etc.)

Regards,
Rajesh
Ian lee
Advisor

Re: How to get created date/time of a file?

I got it!
use ls -i to get inode of the file,and then use fsdb to get the creation time.on hpux11i,output like this:
atime 1122804447 4 (Sun Jul 31 18:07:27 2005 EAT)
mtime 1079844641 210001 (Sun Mar 21 12:50:41 2004 EAT)
ctime 1086345346 600056 (Fri Jun 4 18:35:46 2004 EAT)
But on hpux 11 just output unix time,and you may take some to caculate it:
atime 1046761293 497056 mtime 1046761289 217050 ctime 1046761289 217050

Muthukumar_5
Honored Contributor

Re: How to get created date/time of a file?

No You can not file file creation time and date. Check this.
http://www.faqs.org/faqs/unix-faq/faq/part3/section-1.html

hth.
Easy to suggest when don't know about the problem!