Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copy_to and move_to #1744

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pyiron_base/project/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ def copy_to(
if "_hdf5" not in sub_project_name:
sub_project = self.open(sub_project_name)
destination_sub_project = destination.open(sub_project_name)
sub_project.copy_to(destination_sub_project)
sub_project.copy_to(
destination_sub_project, delete_original_data=delete_original_data
)
for job_id in tqdm(self.get_job_ids(recursive=False), desc="Copying jobs"):
ham = self.load(job_id)
if delete_original_data:
Expand All @@ -275,11 +277,12 @@ def copy_to(
if delete_original_data:
for file in tqdm(self.list_files(), desc="Moving files"):
shutil.move(os.path.join(self.path, file), destination.path)

else:
for file in tqdm(self.list_files(), desc="Copying files"):
if ".h5" not in file:
shutil.copy(os.path.join(self.path, file), destination.path)
if self._data is not None:
pass # ToDo copy the project data
return destination

def create_from_job(self, job_old: "GenericJob", new_job_name: str) -> "GenericJob":
Expand Down
Loading