[clue-tech] mtime isn't

jacob jborer at gmail.com
Tue Apr 7 23:24:48 MDT 2009


On Tue, Apr 7, 2009 at 11:05 PM, David L. Anselmi <anselmi at anselmi.us> wrote:
> chris fedde wrote:
>>
>> On Tue, Apr 7, 2009 at 8:44 PM, David L. Willson
>> <DLWillson at thegeek.nu>wrote:
>>
>>> Why is that when I copy a file from one place to another, the mtime
>>> updates?
>>
>> Mtime is the time when the file's inode was modified. The file system
>> sees that the copy is a new inode so mtime is updated.
>
> What Chris said.  Except I think mtime is when the file data changes. ctime
> is the inode time.  So now tell me why mv doesn't change the mtime (or
> atime).  And besides ctime, what other times change?  And with cp, what
> other times change?

Dave, ctime won't change either - the mtime of the dir you moved the
file to will change. Assuming you are not moving the file between
filesystems. (it should be a link and then unlink)

cp doesn't change times - it copies the data of one file to a new
file. (I assume you don't have a copy on write filesystem that uses
hard links for cp, like a svn store). That is it by default. It is
only concerned with copying the contents of the data block. Not
copying the inode.

>
> So you can use -p if you don't want the times changed.
>

You can also use touch to arbitrarily set the mtime and atime of a file.

Also mtime, atime, and ctime are metadata for the inode and its
associated data blocks, not the contents of the datablocks.

> Dave

Just being nitpicky.

-jacob


More information about the clue-tech mailing list