renaming an open file in nt like unix?

Thomas Heller theller at ctypes.org
Fri Jul 13 13:28:17 EDT 2007


aaron.watters at gmail.com schrieb:
> Hi.  I'm writing an archival system which I'd like to be portable
> to Windows.
> 
> The system relies on the property of Unix which allows a
> process to keep a file open even if another process renames
> it while it is open.  Neither process sees any anomaly or
> error.
> 
> Do the NT file systems support this feature (which I think is
> standard for POSIX systems)?

Yes, you can do that.  We implemented something like this to replace
dlls there are currently in use - rename the currently open file, create a new one
with the old name (newly started processes will use the new one then),
and delete the renamed one at the next possible occasion (usually at
the next reboot).  I'm not so sure on which NT versions it works this
way, at least in w2000 and newer.

Thomas




More information about the Python-list mailing list