Setting file creation date
Tim Peters
tim.one at home.com
Fri Aug 10 16:18:13 EDT 2001
[Fredrik Seehusen]
> 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 :(
I expect you'll have to get the Python Win32 extensions (visit ActiveState's
web site), and use the SetFileTime() Win32 API function (which allows
changing all three times).
[Roman Suzi]
> ...
> Also I remember, Macintosh had file creation time stored,
> but Windows 9x store only two times (probably mtime and ctime).
No, Win9x beasts store all three.
> ...
> So, I wonder where creation date is used and how it survives
> archiving...
Windows archiving systems vary in what they do to the date stamps, and
that's a PITA.
Creation time is exactly what it sounds like <wink>. When you *copy* a file
using native Windows functions, the creation time on the copy is set to the
current time, but the modified time is inherited as-is from the original.
This drives Unix weenies insane, but it's actually quite useful in its own
strange way <wink>. Note that this implies it's quite possible on Windows
to see a file with a modification time older than its creation time --
creation does not imply modification. Of course almost none of this is
documented clearly anywhere (that I know of, anyway).
More information about the Python-list
mailing list