fix 当前路径下没有媒体文件则删除

This commit is contained in:
thsrite 2023-09-19 16:44:20 +08:00
parent dac718edc8
commit d097ef45eb

View File

@ -635,7 +635,7 @@ class TransferChain(ChainBase):
break
if str(parent_path.parent) != str(path.root):
# 父目录非根目录,才删除父目录
files = SystemUtils.list_files(parent_path, settings.RMT_MEDIAEXT)
if not files:
if not SystemUtils.exits_files(path.parent, settings.RMT_MEDIAEXT):
# 当前路径下没有媒体文件则删除
shutil.rmtree(parent_path)
logger.warn(f"目录 {parent_path} 已删除")