Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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