something similar to shutil.copytree that can overwrite?

Ben Sizer kylotan at gmail.com
Wed Jun 20 05:30:15 EDT 2007


I need to copy directories from one place to another, but it needs to
overwrite individual files and directories rather than just exiting if
a destination file already exists. Previous suggestions have focused
on looking at the source for copytree, but it has several places where
exceptions can be raised, and the documentation for the shutil
functions that copytree is implemented in terms of isn't exactly clear
about which exceptions get raised and when. This makes duplicating a
one-line shell operation a non-trivial task.

Has anybody got any pre-written code that does what I'm looking for?

--
Ben Sizer




More information about the Python-list mailing list