How to copy a folder into an existing folder using python
03:14 29 Jun 2022

I am new to python, and am currently trying to copy a folder 'foo' (potentially with some files/folders inside) into another existing folder 'bar'. After this, there should be a new path created that should look something like this "...bar/foo/*".

By copying 'foo' into 'bar' I do not wish to have the original contents in 'bar' to be removed, and the only changes in 'bar' is a new subfolder 'foo' being added.

I have tried to search online for the solution, but was not able to find any libraries that provide such a feature. I would highly appreciate it if I could be provided with some information on how to get started, as I am in need of this feature for another item that I am working on.

The current python version I am using is 3.8.9, so I am able to use any new libraries that were introduced from 3.0 onwards. The platform I am working on is windows.

python python-3.x directory copy-paste subdirectory