Instantly share code, notes, and snippets.

What would you like to do?
import errno
import shutil
def copy(src, dest):
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)
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