dont delete the recordings directory

This commit is contained in:
Blake Blackshear 2020-12-03 08:02:41 -06:00
parent 62728ef7fb
commit c787c8948e

View File

@ -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)