Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.setup > #170

Re: Creation date of a file

From Doug Freyburger <dfreybur@yahoo.com>
Newsgroups comp.os.linux.setup
Subject Re: Creation date of a file
Date 2011-04-08 15:33 +0000
Organization http://mdfsolutionsinc.dealshop.us/
Message-ID <inn9sb$o0t$1@dont-email.me> (permalink)
References <4d9ebae4$0$26370$426a74cc@news.free.fr> <inme3t$150$1@news.albasani.net> <87hba910ra.fsf@araminta.anjou.terraraq.org.uk> <inmra7$t27$1@news.albasani.net>

Show all headers | View raw


The Natural Philosopher wrote:
> Richard Kettlewell wrote:
>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>> bob123 wrote:
>
>>>> how I can find the creation date of a file ?
>
>>> the nearest you will get is the ctime field revealed by stat, I think.
>> 
>> ...which is also updated by chmod, chown, rename, unlink, etc.
>
> I had a nasty feeling that was in fact the case..
>
> But for a normal file that doesn't get subjected to the above tortures, 
> ctime is as good as it gets, no?.

Generally mtime beats ctime.

1) There are a lot of backup utilities (tar is the best known) that
just copy the file to backup media. That sets the atime. There are a
lot of backup utilities (cpio is the best known) that save the inode,
copy the file to backup media, then restore the inode. That preserves
the atime but it sets the ctime. Neither strategy effects the mtime.

2) When writing to a file sometimes the ctime is changed sometimes it is
not.  If a file is extented at all, end of file marker in the inode is
"c"hanged, whether the list of blocks in the inode structure is changed
or not.  This means it happens that ctime is older than mtime but it's
common for both to track.  Add in backups and mtime tends to be older.

The UNIX inode structure does not include a create time the way ODS-2 on
VMS did.  The best you can get is the oldest of mtime, ctime and atime. 
If you have to pick only one, mtime beats ctime for the reasons above.

It's not hard to find all three and compare - Do that.

Back to comp.os.linux.setup | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Creation date of a file "bob123" <nomail@nowhere.com> - 2011-04-08 09:36 +0200
  Re: Creation date of a file The Natural Philosopher <tnp@invalid.invalid> - 2011-04-08 08:39 +0100
    Re: Creation date of a file Richard Kettlewell <rjk@greenend.org.uk> - 2011-04-08 11:43 +0100
      Re: Creation date of a file The Natural Philosopher <tnp@invalid.invalid> - 2011-04-08 12:24 +0100
        Re: Creation date of a file Doug Freyburger <dfreybur@yahoo.com> - 2011-04-08 15:33 +0000
          Re: Creation date of a file Richard Kettlewell <rjk@greenend.org.uk> - 2011-04-08 17:14 +0100

csiph-web