From bdafdd2e95e9acfed079b860fef6a86fab5f627f Mon Sep 17 00:00:00 2001 From: Jonas Tobias Hopusch Date: Wed, 20 Aug 2025 14:16:55 +0200 Subject: [PATCH] feat: cleanup empty directories during move import Signed-off-by: Jonas Tobias Hopusch --- code/creation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/creation.py b/code/creation.py index 25a27c8..a8d9ece 100644 --- a/code/creation.py +++ b/code/creation.py @@ -112,6 +112,9 @@ def transfer_mod_files(source_dir: Path, destination_dir: Path, only_copy: bool) print(f"Unrecognized type, neither file nor directory: {str(file_or_directory)}", file=stderr) + if not only_copy and source_dir.is_dir() and not any(source_dir.iterdir()): + source_dir.rmdir() + def extract_archive(archive_file: Path, destination_dir: Path) -> None: extract_commands: dict[Pattern, Callable[[Path, Path], list[str]]] = {