Deleting files on a shared server

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Oct 8 00:15:36 EDT 2011


En Fri, 07 Oct 2011 04:45:32 -0300, Tim Golden <mail at timgolden.me.uk>  
escribió:
> On 07/10/2011 02:14, Josh English wrote:

>> To delete the files, I am using os.unlink.
>>
>> One lock file refuses to disappear, even though I have code at both
>> application startup and shutdown (on the OnInit and OnExit methods to
>> the wxPython Application object) that hunts down .lock files and
>> deletes them.
>
> Assuming that your code paths succeed and that the unlink actually
> happens, it is possible for files to continue to exist after they
> have been successfully deleted. This happens if another process
> has opened them with share-delete mode; typically this will be
> a virus checker or a process like the TortoiseSVN cache (or its
> counterparts for other VCS). The file won't actually disappear
> until the last handle on it is released.

In such cases the openfiles command [1] is very useful for detecting who  
is holding the file open.

[1]  
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/openfiles.mspx

-- 
Gabriel Genellina




More information about the Python-list mailing list