problem recursively removing directories on an NFS mount

Curtis Jensen cjensen at bioeng.ucsd.edu
Tue Jul 30 10:11:12 EDT 2002


Dr. Marco wrote:
> On Mon, 24 Jun 2002 10:32:15 -0700, 
> Curtis Jensen <cjensen at bioeng.ucsd.edu> wrote :
> 
> 
>>fine.  However, sometimes nfs files of the form ".nfs07D7761" get
>>created.  This causes the os.rmdir( full_name ) command to throw an
> 
> 
> Such files appear when you remove a remote file that is still opened
> by another program. They should disappear when the file is closed. A
> solution could be to move them to another directory but I confess I
> don't know if this can be done safely.
> 

Thanks for the reply.  Unfortunatly, the .nfs files don't appear until 
after the script starts to remove files.  To remove the .nfs file I'd 
have to loop over the directory listing again in an exception handler. 
A fix I found was to use "shutil.rmtree" instead of "os.remove"  I 
haven't had any problems with shutil.

-- 
Curtis Jensen
cjensen at bioeng.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451




More information about the Python-list mailing list