This commit is contained in:
2026-03-02 00:25:40 +01:00
parent e7d6d288a8
commit b665cb5def
32 changed files with 3287 additions and 953 deletions

View File

@@ -17,7 +17,7 @@ def _delete_recursive(conn, nodes):
def _try_rm(conn, path, is_dir=False):
icon = "📁" if is_dir else "📄"
try:
conn.send_command(f"rm {path}")
conn.rm(path)
print(f" 🗑️ {icon} Gelöscht: {path}")
except BuzzerError as e:
print(f" ❌ Fehler bei {path}: {e}")
@@ -53,21 +53,16 @@ def execute(conn, path: str, recursive: bool = False):
# 2. Rekursives Löschen (-r)
if recursive:
print(f"Sammle Dateibaum für rekursives Löschen von '{path}'...")
tree = get_file_tree(conn, target_path=path, recursive=True)
if len(tree) == 1 and tree[0].get("type") == "E":
print(f"Pfad nicht gefunden oder Fehler: {tree[0]['name']}")
return
if not tree:
print(f"Ordner '{path}' ist bereits leer.")
else:
_delete_recursive(conn, tree)
# 3. Standard-Löschen (Einzeldatei oder am Ende der Rekursion der leere Ordner)
try:
conn.rm_recursive(path)
print(f"🗑️ '{path}' rekursiv gelöscht.")
except BuzzerError as e:
print(f"Fehler beim rekursiven Löschen von '{path}': {e}")
return
# 3. Standard-Löschen (Einzeldatei oder leeres Verzeichnis)
try:
conn.send_command(f"rm {path}")
conn.rm(path)
print(f"🗑️ '{path}' erfolgreich gelöscht.")
except BuzzerError as e:
print(f"❌ Fehler beim Löschen von '{path}': {e}")