From f0a7704a0e44342b7b747a35a56173e23f955688 Mon Sep 17 00:00:00 2001 From: ZenithalHourlyRate Date: Thu, 7 Oct 2021 22:27:15 +0800 Subject: [PATCH] apt-sync: rm dir after mv all files in it Otherwise tmp_dir.rmdir() would fail as dirs in it have not been deleted --- apt-sync.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apt-sync.py b/apt-sync.py index df08e5b..f07dbf1 100755 --- a/apt-sync.py +++ b/apt-sync.py @@ -108,6 +108,7 @@ def move_files_in(src: Path, dst: Path): if file.is_dir(): (dst / file.name).mkdir(parents=True, exist_ok=True) move_files_in(file, dst / file.name) + file.rmdir() # rmdir wont fail as all files in it have been moved else: file.rename(dst / file.name) # Overwrite files if empty: