From c787c8948e674ba57963273d6c6c123ae27a3f51 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Thu, 3 Dec 2020 08:02:41 -0600 Subject: [PATCH] dont delete the recordings directory --- frigate/record.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frigate/record.py b/frigate/record.py index f7ecb2032..a6be58bdc 100644 --- a/frigate/record.py +++ b/frigate/record.py @@ -22,11 +22,14 @@ def remove_empty_directories(directory): # list all directories recursively and sort them by path, # longest first paths = sorted( - [x[0] for x in os.walk('/media/frigate/recordings/')], + [x[0] for x in os.walk(RECORD_DIR)], key=lambda p: len(str(p)), reverse=True, ) for path in paths: + # don't delete the parent + if path == RECORD_DIR: + continue if len(os.listdir(path)) == 0: os.rmdir(path)