I am trying to copy a source code tree using the below code and running into an error,am not sure why I am getting this?error says \\\\Ref\\builds/out exists but it doesnt exist
The documentation for shutil.copytree clearly says:
The destination directory, named by
dst
, must not already exist; it will be created as well as missing parent directories.
But \\ref\builds\out
already exists—you can see from the exception's stack trace that it's trying to mkdir
that path, but that's failing with an error indicating that that path already exists (which can happen when the path exists as either a regular file or a directory).
You need to copy to path that doesn't already exist, by either choosing a different path, or by deleting the existing tree at that location first. The latter can be done with shutil.rmtree
.