Skip to content
Snippets Groups Projects
Commit cb71edc8 authored by John Chilton's avatar John Chilton
Browse files

Merge pull request #107 from natefoo/copy-makedirs

Ensure destination directories exist when copying files
parents aa68a260 2b651e77
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,8 @@ def copy(source, destination):
source = os.path.abspath(source)
destination = os.path.abspath(destination)
if source != destination:
if not os.path.exists(os.path.dirname(destination)):
os.makedirs(os.path.dirname(destination))
shutil.copyfile(source, destination)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment