question of tar

Les Mikesell lesmikesell at gmail.com
Mon Apr 14 00:17:51 UTC 2008


Kevin J. Cummings wrote:
>
> While looking at the tar man page, I see the following:
> 
>>        -N, --after-date DATE, --newer DATE
>>               only store files newer than DATE
>>
>>        --newer-mtime DATE
>>               like --newer, but with a DATE
> 
> I didn't like the explanation, so I looked at the info file for tar:
> 
>> `--after-date=DATE'
>> `--newer=DATE'
>> `-N DATE'
>>      Only store files newer than DATE.
>>
>>      Acts on files only if their modification or inode-changed times are
>>      later than DATE.  Use in conjunction with any operation.
>>    Gurus would say that `--after-date=DATE' (`--newer=DATE', `-N DATE')
>> tests both the `mtime' (time the contents of the file were last
>> modified) and `ctime' (time the file's status was last changed: owner,
>> permissions, etc) fields, while `--newer-mtime=DATE' tests only `mtime'
>> field.


>>    To be precise, `--after-date=DATE' (`--newer=DATE', `-N DATE')
>> checks _both_ `mtime' and `ctime' and processes the file if either one
>> is more recent than DATE, while `--newer-mtime=DATE' only checks
>> `mtime' and disregards `ctime'.  Neither uses `atime' (the last time the
>> contents of the file were looked at).

mtime can never be more recent than ctime unless it is artificially 
written in the future.  Changing mtime is a change to the inode which 
also forces an update to ctime.

> Based on this explantation, it begs the question:
> 
> Does it work for you with --newer-mtime=DATE rather than -N DATE which
> doesn't do what you want?

A better question is why you wouldn't want to base the copies on ctime. 
  This will catch renamed files with their new names and new files that 
have been copied into place with a mechanism that preserves an old mtime.

-- 
   Les Mikesell
    lesmikesell at gmail.com




More information about the fedora-list mailing list