something similar to shutil.copytree that can overwrite?

Justin Ezequiel justin.mailinglists at gmail.com
Mon Jun 25 03:20:05 CEST 2007


On Jun 22, 9:07 pm, Ben Sizer <kylo... at gmail.com> wrote:
> That's the easy bit to fix; what about overwriting existing files
> instead of copying them? Do I have to explicitly check for them and
> delete them? It seems like there are several different copy functions
> in the module and it's not clear what each of them do. What's the
> difference between copy, copyfile, and copy2? Why do the docs imply
> that they overwrite existing files when copytree skips existing
> files?
>
> --
> Ben Sizer

copytree does not skip existing files
if will overwrite said files
I just missed the makedirs call at the start
the failed makedirs call will cause the copytree function to exit
completely
thus you do not get your files updated
but with the if exists check, your files should get overwritten





More information about the Python-list mailing list