[issue1577] shutil.move() does not use os.rename() if dst is a directory

Guido van Rossum report at bugs.python.org
Mon Dec 10 19:15:06 CET 2007


Guido van Rossum added the comment:

We should first decide what should happen.  While for command line tools
"mv FILE DIR" is established syntax for "mv FILE DIR/`basename FILE`",
I'm not at all sure that shutil.move(src, dst) should do the same.  I
think it should be closer to the UNIX os.rename() semantics which
promises that src *replaces* dst.  If dst is an empty dir, it is removed
using rmdir(); if it is a non-empty dir, the removal fails and hence the
move fails.  I think this is what shutil.move() should do too.  (Even if
it can't make the atomicity promises that UNIX makes.)

----------
nosy: +gvanrossum

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1577>
__________________________________


More information about the Python-bugs-list mailing list