Last active
August 29, 2015 14:03
-
-
Save somada141/fcc5e876002a712d55fd to your computer and use it in GitHub Desktop.
How to Recursively Copy a Folder (Directory) in Python #python #fileIO #shutil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
def copyDirectory(src, dest): | |
try: | |
shutil.copytree(src, dest) | |
# Directories are the same | |
except shutil.Error as e: | |
print('Directory not copied. Error: %s' % e) | |
# Any error saying that the directory doesn't exist | |
except OSError as e: | |
print('Directory not copied. Error: %s' % e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment