From 69ec7e5015a2a557f2c0f26ddc2ebbf36d4ec3dd Mon Sep 17 00:00:00 2001 From: Federico Leva Date: Mon, 21 May 2018 07:30:51 +0300 Subject: [PATCH] Use os.listdir() and avoid os.walk() in launcher too With millions of files, everything stalls otherwise. --- launcher.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/launcher.py b/launcher.py index 02337e9..0139d89 100644 --- a/launcher.py +++ b/launcher.py @@ -45,12 +45,10 @@ def main(): #check if compressed, in that case dump was finished previously compressed = False - for dirname, dirnames, filenames in os.walk('.'): - if dirname == '.': - for f in filenames: - if f.startswith(prefix) and f.endswith('.7z'): - compressed = True - zipfilename = f + for f in os.listdir('/mnt/raccolto/wikia'): + if f.startswith(prefix) and f.endswith('.7z'): + compressed = True + zipfilename = f break #stop searching, dot not explore subdirectories if compressed: