renaming an open file in nt like unix?

Steve Holden steve at holdenweb.com
Fri Jul 13 20:44:09 CEST 2007


Thomas Heller wrote:
> 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
> 
You do have to be careful though, because sometimes Windows refuses to 
let you rename a file because it's in use.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------




More information about the Python-list mailing list