Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determining date of file creation 1

Status
Not open for further replies.

langford

Technical User
Aug 25, 2001
13
0
0
GB
I have been trying to determine the date on which a file was created and was under the impression that if there was no year present (only time of day) then this meant that it was created this year 2002. However I have files with a time of day and a month value of Aug? As we are in Feb how is this possible.

Apologies if this is a bit simplistic,
Thank you.
 
The year is shown if the last modification time was more than 6 months ago, so the date/time display would go back to August.

To show the creation date of a file, use ls -lc where -c displays the last modification time of the i-node.

Greg.
 
This is one from Carlso Almeida (as I recall):

you cannot obtain creation time (ctime) ctime, is NOT the files creation date, creation date is not recorded anywhere in the Unix file system:

"mtime" - time the contents of file was last modified (written to).
"atime" - time the file was last used/accessed (read or executed)
"ctime" - time the inode of the file was last changed (like changing permissions), ctime also gets updated every time mtime is modified, but not when the atime is changed.

None of the Unix commands can do this directly, but the information can be easily obtained using the truss command,
to get all 3 time stamps for a file and to output that information:

# touch teste
# truss -vlstat -tlstat ls -l teste
lstat64("teste", 0xFFBEFC98) = 0
d=0x00000002 i=1886769 m=0100644 l=1 u=0 g=1 sz=0
at = Sep 12 02:44:07 WEST 2001 [ 1000259047 ]
mt = Sep 12 02:44:07 WEST 2001 [ 1000259047 ]
ct = Sep 12 02:44:07 WEST 2001 [ 1000259047 ]
bsz=8192 blks=0 fs=tmpfs
-rw-r--r-- 1 root other 0 Sep 12 02:44 teste


 
Hi grega and sese,

Thank you both for the advice, has helped a great deal.

Cheers
Langford
 
fsdb will give you the information you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top