[Python] Copy a directory in python without overwriting the destination

Discussão em 'Python' iniciado por Stack, Setembro 11, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to recursively copy a directory into another directory using shutil.copytree() this works great to a degree.

    The problem I run into is that I have multiple directories that I want to copy into the destination directory. It seems that the only option is to overwrite whatever is in the destination directory when I copy the files.

    Is there a way of recursively copying the files from one directory into another that does not overwrite the destination? Googling around has only turned up options for overwriting the destination using shutil.copytree()

    Continue reading...

Compartilhe esta Página