diff --git a/plotid/publish.py b/plotid/publish.py index 428f3f94b49abb30f0333c186f0ca3e3b07025b2..8912a2a4100be4b14a79c680c3cbc084580e6810 100644 --- a/plotid/publish.py +++ b/plotid/publish.py @@ -211,7 +211,12 @@ class PublishOptions: # Copy data to destination folder for path in self.src_datapaths: try: - shutil.copytree(path, destination, dirs_exist_ok=True) + _, src_dir_name = os.path.split(path) + # Create new dst directory to include the top level directory of + # the source files. So that copying A to B results in B/A and not only + # the contents of A to B. + new_destination = os.path.join(destination, src_dir_name) + shutil.copytree(path, new_destination, dirs_exist_ok=True) except NotADirectoryError: shutil.copy2(path, destination)