diff --git a/stages/run_opensfm.py b/stages/run_opensfm.py index 7ceefd89..a5bf34c1 100644 --- a/stages/run_opensfm.py +++ b/stages/run_opensfm.py @@ -34,10 +34,12 @@ class ODMOpenSfMStage(types.ODM_Stage): self.update_progress(70) if args.optimize_disk_space: - shutil.rmtree(octx.path("features")) - shutil.rmtree(octx.path("matches")) - shutil.rmtree(octx.path("exif")) - shutil.rmtree(octx.path("reports")) + for folder in ["features", "matches", "exif", "reports"]: + folder_path = octx.path(folder) + if os.path.islink(folder_path): + os.unlink(folder_path) + else: + shutil.rmtree(folder_path) # If we find a special flag file for split/merge we stop right here if os.path.exists(octx.path("split_merge_stop_at_reconstruction.txt")):