From e3b85508f1a3e659fbba399e71a539a21cc02a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 2 Oct 2023 16:16:22 +0200 Subject: [PATCH] fix: Attempt to check if a directory is empty faster. --- bin/archiver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/archiver.py b/bin/archiver.py index 18c32231..dcec7410 100755 --- a/bin/archiver.py +++ b/bin/archiver.py @@ -54,7 +54,7 @@ class Archiver(AbstractManager): def _update_index(self, root_dir: Path) -> None: current_index: Dict[str, str] = {} - if not os.listdir(root_dir): + if not any(os.scandir(root_dir)): # the directory is empty, we can safely remove it root_dir.rmdir() return