On 11/28/05, Wijaya Edward <[EMAIL PROTECTED]> wrote:
>
>
>
> ----- Original Message -----
> From: Jennifer Garner <[EMAIL PROTECTED]>
> Date: Monday, November 28, 2005 12:30 pm
> Subject: how to get file's creation time
>
>
> > How to get file's creation time,NOT last modify time?Thanks.
>
> I don't think it is possible, in unix environment.
>
> Read this comment by Randall Schwartz,
> http://www.perlmonks.org/index.pl?node_id=479799
>
> Hope it gives you a hint ...
>
> ---
> Regards,
> Edward WIJAYA
> SINGAPORE

It depends on what you mean by "creation". stat() on POSIXish systems
returns ctime, which is the inode creation time, which is the time the
physical location on disk was first written to (actually, these days
it's the time the vnode was fist written to, but you don't really care
that much about disk geometry, do you?). The time will not be
preserved across relocations (i.e. mv and cp will destroy it),
although many archivers reinstate the file's original ctime when files
are restored from backup. For most applications, though, "when this
particular disk space was reserved for data" is an effective synonym
for "when this file was created. When you start moving files around,
the questions merlyn raises become much more important.

For the record, Kirk McKusick--one of the original implemetors of
UFS/FFS and the creator of UFS2--tells the story a little differently.
 According to him, the FFS originally intended to use ctime as the
creation time, but they discovered that dump needed a record of inode
creation to make incrimental backups effectively. In fact, UFS2
includes a btime (call it "birth time" if you want) field that is
stable across inode relocations when the system uses btime aware file
system operations. I don't know, though, if the Perl team has plans to
update stat() to support it on systems where it is available.

Of course, that isn't completely at odds with merlyn's comments: the
original unix developers started implementing file systems a decade
before Berkely started work on FFS.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to