mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
dont delete the recordings directory
This commit is contained in:
parent
040f8c7c20
commit
d1a7405211
@ -22,11 +22,14 @@ def remove_empty_directories(directory):
|
|||||||
# list all directories recursively and sort them by path,
|
# list all directories recursively and sort them by path,
|
||||||
# longest first
|
# longest first
|
||||||
paths = sorted(
|
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)),
|
key=lambda p: len(str(p)),
|
||||||
reverse=True,
|
reverse=True,
|
||||||
)
|
)
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
# don't delete the parent
|
||||||
|
if path == RECORD_DIR:
|
||||||
|
continue
|
||||||
if len(os.listdir(path)) == 0:
|
if len(os.listdir(path)) == 0:
|
||||||
os.rmdir(path)
|
os.rmdir(path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user