From 32b8e0702c753b03afabb8afa022114cdb9b6c15 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sun, 5 Nov 2023 02:19:46 +0000 Subject: [PATCH] Fix file deletion, now erases folders and files. --- cista/protocol.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cista/protocol.py b/cista/protocol.py index f793345..8008ac7 100644 --- a/cista/protocol.py +++ b/cista/protocol.py @@ -44,7 +44,10 @@ class Rm(ControlBase): root = config.config.path sel = [root / filename.sanitize(p) for p in self.sel] for p in sel: - shutil.rmtree(p, ignore_errors=True) + if p.is_dir(): + shutil.rmtree(p, ignore_errors=True) + else: + p.unlink() class Mv(ControlBase):