From 0e61eee899592193f0b470f5e98934f32b166042 Mon Sep 17 00:00:00 2001 From: Fredrik Eriksson Date: Mon, 21 Dec 2020 12:57:53 +0100 Subject: [PATCH] fix handling of files with non-matching names... --- rotator/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rotator/__init__.py b/rotator/__init__.py index 1218ac7..68a8b76 100644 --- a/rotator/__init__.py +++ b/rotator/__init__.py @@ -19,7 +19,9 @@ def get_files_in_dir(path, regex, timeformat, recurse=False): for root,dirs,files in os.walk(path, topdown=False): for f in files: prefix, timestamp = parse_filename(f, regex, timeformat) - if prefix and prefix not in res: + if not prefix: + continue + if prefix not in res: res[prefix] = set() res[prefix].add((os.path.join(root,f), timestamp)) if not recurse: