(lang: str)
| 1594 | return |
| 1595 | |
| 1596 | moved, skipped, _trash_dir = move_to_trash(root, to_trash) |
| 1597 | print(t("trash_done", lang, n=moved)) |
| 1598 | if skipped: |
| 1599 | print(t("trash_skip", lang, n=skipped)) |
| 1600 | |
| 1601 | def run_remove_empty(lang: str) -> None: |
| 1602 | print(t("remove_empty_title", lang)) |
| 1603 | root = prompt_path(lang, Path(".")) |
| 1604 | if not root.exists(): |
| 1605 | print(t("err_path_missing", lang, path=root)) |
| 1606 | return |
| 1607 | depth = prompt_int(lang, 12) |
| 1608 | hide_dot = yesno(lang, "prompt_hide_dot", False) |
| 1609 | include_hidden = not hide_dot |
| 1610 | follow = yesno(lang, "prompt_follow", False) |
| 1611 | ignore = normalize_patterns(prompt_text(lang, "prompt_ignore", "")) |
| 1612 | |
| 1613 | empties = find_empty_folders(root, max_depth=depth, include_hidden=include_hidden, follow_symlinks=follow, ignore=ignore) |
| 1614 | # never move root itself |
| 1615 | empties = [p for p in empties if p != root] |
| 1616 | print(t("empty_found", lang, n=len(empties))) |
| 1617 | if not empties: |
| 1618 | return |
| 1619 | |
| 1620 | preview = "\n".join(f" - {p}" for p in empties[:20]) |
| 1621 | print(preview + ("\n..." if len(empties) > 20 else "")) |
| 1622 | |
| 1623 | trash_dir_preview = (root if root.is_dir() else root.parent) / ".TreeExplorerTrash" |
| 1624 | print(t("trash_confirm_msg", lang, trash=trash_dir_preview)) |
| 1625 | confirm = input(t("prompt_confirm", lang)).strip() |
| 1626 | if confirm != "YES": |
| 1627 | return |
| 1628 | |
| 1629 | moved, skipped, _trash_dir = move_to_trash(root, empties) |
| 1630 | print(t("trash_done", lang, n=moved)) |
no test coverage detected