public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Is it possible to alter Birth time?
@ 2020-10-08  9:33 Fergus Daly
  2020-10-08 13:49 ` Eric Blake
  2020-10-12  7:09 ` Andrey Repin
  0 siblings, 2 replies; 3+ messages in thread
From: Fergus Daly @ 2020-10-08  9:33 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is it possible to alter Birth time?
  2020-10-08  9:33 Is it possible to alter Birth time? Fergus Daly
@ 2020-10-08 13:49 ` Eric Blake
  2020-10-12  7:09 ` Andrey Repin
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2020-10-08 13:49 UTC (permalink / raw)
  To: Fergus Daly, 'cygwin@cygwin.com'


[-- Attachment #1.1: Type: text/plain, Size: 1369 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is it possible to alter Birth time?
  2020-10-08  9:33 Is it possible to alter Birth time? Fergus Daly
  2020-10-08 13:49 ` Eric Blake
@ 2020-10-12  7:09 ` Andrey Repin
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Repin @ 2020-10-12  7:09 UTC (permalink / raw)
  To: Fergus Daly, cygwin

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-12  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08  9:33 Is it possible to alter Birth time? Fergus Daly
2020-10-08 13:49 ` Eric Blake
2020-10-12  7:09 ` Andrey Repin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).