Skip to content

Commit

Permalink
Merge pull request #16 from Neves-P/feature/disk_cleanup
Browse files Browse the repository at this point in the history
copytree with dirs_exist_ok True
  • Loading branch information
Neves-Bot authored Jul 5, 2024
2 parents 1c08013 + da970e7 commit 3673540
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tasks/clean_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def move_to_trash_bin(trash_bin_dir, job_dirs):
# Remove event_xxx-yyy/run_nnn/ directories
pr_dirs = list(set(pr_dirs)) # get only unique dirs
for pr_dir in pr_dirs:
destination_dir = shutil.copytree(pr_dir, trash_bin_dir)
log(f"{funcname}(): attempting to copy {pr_dir} to {trash_bin_dir}")
destination_dir = shutil.copytree(pr_dir, trash_bin_dir, dirs_exist_ok=True)
log(f"{funcname}(): copied {pr_dir} to {destination_dir}")
shutil.rmtree(pr_dir) # Use shutil.rmtree to remove directories recursively
log(f"{funcname}(): removed {pr_dir}")
Expand Down

0 comments on commit 3673540

Please sign in to comment.