problem recursively removing directories on an NFS mount
Curtis Jensen
cjensen at bioeng.ucsd.edu
Mon Jun 24 13:32:15 EDT 2002
I have a function to recursively remove directories:
def removeDir( dirName ):
"""recursively remove a directory """
for name in os.listdir( dirName ):
full_name = os.path.join(dirName, name)
if os.path.isdir( full_name ):
removeDir( full_name )
else:
os.remove( full_name )
#end for name
os.rmdir( dirName )
Using python1.5.2 on an IRIX 6.5 system, this function usually works
fine. However, sometimes nfs files of the form ".nfs07D7761" get
created. This causes the os.rmdir( full_name ) command to throw an
exception because the directory is not empty. It appears that the
os.remove() function causes NFS to generate these files. Is this a bug
in os.remove or nfs or my function? What would be the best way to fix
this problem?
Thanks.
--
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