diff --git a/src/spikeinterface/preprocessing/motion.py b/src/spikeinterface/preprocessing/motion.py index a98bdc171a..71ae3f3ebb 100644 --- a/src/spikeinterface/preprocessing/motion.py +++ b/src/spikeinterface/preprocessing/motion.py @@ -320,8 +320,9 @@ def correct_motion( if folder is not None: folder = Path(folder) if overwrite: - if folder.exists(): + if folder.exists(): import shutil + shutil.rmtree(folder) else: assert not folder.exists(), f"Folder {folder} already exists"