Folder1:
tree
.
├── abc.json
├── pqr.bson
├── subdir
│ ├── abc.json
│ ├── pqr.bson
│ └── xyz.json
└── xyz.json
1 directory, 6 files
import os
import shutil
sourcefolder="./Folder1"
destinationfolder="./Folder2"
if os.path.exists(destinationfolder):
shutil.rmtree(destinationfolder)
shutil.copytree(sourcefolder,destinationfolder)
Folder2:
tree
.
├── abc.json
├── pqr.bson
├── subdir
│ ├── abc.json
│ ├── pqr.bson
│ └── xyz.json
└── xyz.json
1 directory, 6 files
I would like copy along with source folder as well something like below under Folder2:
Folder2:
tree
├── Folder1
│ ├── abc.json
│ ├── pqr.bson
│ ├── subdir
│ │ ├── abc.json
│ │ ├── pqr.bson
│ │ └── xyz.json
│ └── xyz.json
Is there a way we can do this with in copytree
?