Setting file creation date
aleaxit at yahoo.com
Fri Aug 10 19:02:51 CEST 2001
"Roman Suzi" <rnd at onego.ru> wrote in message
news:mailman.997454355.12463.python-list at python.org...
> On Fri, 10 Aug 2001, Alex Martelli wrote:
> >"Fredrik Seehusen" <fse at npt.no> wrote in message
> >news:e77b4645.0108100226.4cfaf671 at posting.google.com...
> >> Hello,
> >> How do I set the creation date when opening a file, or override the
> >> creation date of a given file (... if it is possible in python)?
> >> This has to be done in Windows NT by the way :(
> >os.utime lets you set the accessed and modified dates, but I
> >don't think NT lets you change creation-date -- you'd have to
> >change your computer's date, create a new file copying the
> >old one, etc, etc, I suspect.
> Sorry for my total ignorance of NT, but AFAIK UNIX/Linux do not
> have file creation date stored:
True; the 'c' stands for 'change' (to status), not for 'creation',
on unix-like filesystems.
> Also I remember, Macintosh had file creation time stored,
> but Windows 9x store only two times (probably mtime and ctime).
Wrong. API GetFileTime correctly returns all three times
(creation, last access, last write) on both NT and 9x and on
both NTFS and FAT filesystems (the issue with the latter
is the resolution of 2 seconds:-).
Which reminds me, SetFileTime lets you change those, and
I don't know why win32file (part of the win32api) still does
not make that call available according to the latest manual
at URL [a single line, some sw will break it]:
Should be a C extension of a few lines, worst case. Much
simpler/faster than the rigmarole of change-date/copy-file/&c
which I previously suggested. Maybe calldll.pyd can help.
> atime and mtime are quite easy to change, and the nature
> of ctime is more subtle.
> So, I wonder where creation date is used and how it survives
On NT? It survives perfectly and it's quite useful, because the
*modification* time may happen to be bogus while the creation
time is often more reliable.
More information about the Python-list