I need a function in python that lets me specify the source and destination paths for a folder and copies the source folder recursively into the destination folder. The implementation I am looking for needs to be platform independent
You could use shutil.copytree:
shutil.copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False)
Recursively copy an entire directory tree rooted at src, returning the destination directory. The destination directory, named by dst, must not already exist; it will be created as well as missing parent directories. Permissions and times of directories are copied with copystat(), individual files are copied using shutil.copy2().
import shutil
shutil.copytree(src, dst)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With