From 480199085e980413c7eb1302df802ed7ea3f6275 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 27 Jul 2014 19:11:24 -0700 Subject: [PATCH] Fix for images in cache folder being deleted by cleaner routine. --- sickbeard/helpers.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 4b43d949..ea17708c 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -1336,12 +1336,9 @@ def clearCache(force=False): max_age = datetime.timedelta(hours=12) # Get all our cache files - for cache_root, cache_dirs, cache_files in os.walk(sickbeard.CACHE_DIR): - path = os.path.basename(cache_root) - - # skip these cache folders - if path in ['rss', 'images']: - continue + exclude = ['rss', 'images'] + for cache_root, cache_dirs, cache_files in os.walk(sickbeard.CACHE_DIR, topdown=True): + cache_dirs[:] = [d for d in cache_dirs if d not in exclude] for file in cache_files: cache_file = ek.ek(os.path.join, cache_root, file)