Is it possible to alter Birth time?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to alter Birth time?

Cygwin list mailing list
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?
Thank you.

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to alter Birth time?

Cygwin list mailing list
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


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to alter Birth time?

Cygwin list mailing list
In reply to this post by Cygwin list mailing list
Greetings, Fergus Daly!

> 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?

Technically yes, but not with standard tools.
You'd need something like filemanager with necessary capability, or a custom
written tool.


--
With best regards,
Andrey Repin
Monday, October 12, 2020 10:07:57

Sorry for my terrible english...

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple