Preserving target file's creation date
kh at panix.com
Thu Oct 1 21:46:33 UTC 2020
RW via freebsd-questions writes:
>There are four timestamps: atime, mtime, ctime and btime.
>The first two are data access and modification. ctime is when the
>metadata in the inode was last modified, the 'c' is for changed, not
>btime is time the file/inode was created (b for birth), but it's not
Yes. Historically, there were three file times: atime, mtime, ctime
(historically called creation time, though it's actually been inode
modification time for as long as I know of).
The fourth, birth time, was added much later, and I think only in
FreeBSD. To maximize confusion, people sometimes call this creation
time, too. Don't do that.
Somebody who has Linux handy could check what file times it has. You
might look at what comes back from the system call stat().
>I just had a look at some files I recently copied with dump|restore and
>it had preserved all 4 times. I also found:
>cp -p preserved atime, mtime and btime.
>rsync -a preserved mtime and btime
>I find the last two results strange as cp(1) and rsync(1) don't claim
>to preserve btime. I'd be surprised if rsync even knows about it.
I just found that cp without -p preserves birth time, as you would
hope, though ctime changes.
Perhaps some of these old utilities that run on many Unixes don't know
about the FreeBSD birth time.
I'll attach to this message a C program I wrote that displays all four
file times. We'll see whether the mailing list allows the attachment.
(In the past this list has removed attachments of type text/x-csrc;
I'll make this one text/plain).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the freebsd-questions