NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: setting file creation time of a date

On 2020-04-30 12:21, Riccardo Mottola wrote:

I have a more programmer question.
Standard POSIX (and thus e.g. linux) handle only the modification date of the file.

NetBSD, FreeBSD, Darwin/Mac (and even windows) keep also track of the creation date.

stat birthtime, birthtimespec, birthtim are the BSD names inside the structure

I can with lstat get it and on copy of a file, set it using by using utime(3) or utimensat(3)

But can I set the creation time? I'd like to be able to preserve it when dealing with files.

Looking at the utimes system call, you can potentially modify the birthtime through that. But only indirectly, and in one direction.

If you set modification time to something older than birthtime, birthtime will be changed to modification time.


Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email:             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol

Home | Main Index | Thread Index | Old Index