]> granicus.if.org Git - python/commitdiff
Unlink before rename (for NT).
authorGuido van Rossum <guido@python.org>
Mon, 19 May 1997 15:20:49 +0000 (15:20 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 19 May 1997 15:20:49 +0000 (15:20 +0000)
Tools/scripts/ftpmirror.py

index 11b618f751d2cb5ec4580b1aff3cad61819cfbac..f25864be497d3ad0720da5e62a57fb2142b8e4a3 100755 (executable)
@@ -198,7 +198,11 @@ def mirrorsubdir(f, localdir):
                if fp1 != fp:
                        fp1.close()
                try:
-                   os.rename(tempname, fullname)
+                       os.unlink(fullname)
+               except os.error:
+                       pass            # Ignore the error
+               try:
+                       os.rename(tempname, fullname)
                except os.error, msg:
                        print "Can't rename %s to %s: %s" % (tempname,
                                                             fullname,