Is it possible to alter Birth time?

Eric Blake eblake@redhat.com
Thu Oct 8 13:49:57 GMT 2020


On 10/8/20 4:33 AM, Fergus Daly via Cygwin wrote:
> In Cygwin (and on some, not all, Linux file systems) the command
> $ stat filename
> shows all of Access, Modify, Change and Birth times of a file.
> The command
> $ touch [options] filename
> will alter some or all of Access, Modify, Change times, as specified
> in [options].
> Is it possible in Cygwin (or for that matter in Windows) to alter the
> Birth time of a file or directory?

Not short of deleting the file and creating a new one in its place, and
even then, the birthtime is controlled by the current system clock and
not something you can modify after the fact.  And that answer is
identical to what you have on BSD or Linux, on file systems that support
birth time there.

And actually, touch can't modify the change time of a file to anything
other than the current time; it is only access and modify times that can
be set arbitrarily.

(If you REALLY want to modify birth and change times, and have superuser
access, you can open the raw block device and flip bits behind the file
system's back - but that's not something you want to be doing on a
regular basis, nor should you attempt it while a file system is mounted
on that block device)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://cygwin.com/pipermail/cygwin/attachments/20201008/a98fa208/attachment.sig>


More information about the Cygwin mailing list