Created
November 26, 2017 12:47
-
-
Save mahmudahsan/e6c9c63a23bf4918c13fc8e2df513ebd to your computer and use it in GitHub Desktop.
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 errno | |
import shutil | |
def copy(src, dest): | |
try: | |
shutil.copytree(src, dest) | |
except OSError as e: | |
# If the error was caused because the source wasn't a directory | |
if e.errno == errno.ENOTDIR: | |
shutil.copy(src, dest) | |
else: | |
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