1
0
mirror of https://github.com/azlux/botamusique synced 2024-11-23 13:56:17 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
6115a0d3ee
Merge pull request #363 from kac-/fix-yt-0
fix: util: clear_tmp_folder: exclude invalid symlinks
2023-05-30 22:55:33 +02:00
kac-
5582d14101 fix: util: clear_tmp_folder: exclude invalid symlinks 2023-05-30 11:49:37 +02:00

View File

@ -547,6 +547,8 @@ def clear_tmp_folder(path, size):
all_files = "" all_files = ""
for (path, dirs, files) in os.walk(path): for (path, dirs, files) in os.walk(path):
all_files = [os.path.join(path, file) for file in files] all_files = [os.path.join(path, file) for file in files]
# exclude invalid symlinks (linux)
all_files = [file for file in all_files if os.path.exists(file)]
all_files.sort(key=lambda x: os.path.getmtime(x)) all_files.sort(key=lambda x: os.path.getmtime(x))
size_tp = 0 size_tp = 0
for idx, file in enumerate(all_files): for idx, file in enumerate(all_files):