[New-bugs-announce] [issue1577] shutil.move() does not use os.rename() if dst is a directory
report at bugs.python.org
Mon Dec 10 00:23:25 CET 2007
New submission from Ingemar Nilsson:
If you use shutil.move(src, dst) to move a file src to a directory dst,
the file will not be renamed into the dst directory, but rather
copied-then-removed, even if src and dst is on the same filesystem.
There are several ways to fix this:
* (The easiest) Fix the documentation for shutil.move() so that this is
* Fix shutil.move() so that it rename a file into a new directory.
* Change os.rename() to accept a directory as a destination for a file.
The reason for this problem is that shutil.move() tries to use
os.rename(), but fails since the destination is a directory. It then
proceeds to the copy-then-remove method, even though the documentation
gives the impression that this only happens when src and dst are on
components: Library (Lib)
title: shutil.move() does not use os.rename() if dst is a directory
versions: Python 2.5
Tracker <report at bugs.python.org>
More information about the New-bugs-announce