1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 11:31:46 +00:00

fix: enhance performance of application support log cleanup using find -delete

This commit is contained in:
tw93
2026-01-31 20:22:52 +08:00
parent 9da70886cd
commit d0a95f5e31

View File

@@ -583,6 +583,10 @@ clean_application_support_logs() {
((cleaned_count++))
found_any=true
if [[ "$DRY_RUN" != "true" ]]; then
# For directories with many files, use find -delete for performance
# This avoids shell expansion and individual safe_remove calls
if ! find "$candidate" -mindepth 1 -delete 2> /dev/null; then
# Fallback: try item-by-item if find fails
for item in "$candidate"/*; do
[[ -e "$item" ]] || continue
safe_remove "$item" true > /dev/null 2>&1 || true
@@ -590,6 +594,7 @@ clean_application_support_logs() {
fi
fi
fi
fi
done
done
# Group Containers logs (explicit allowlist).