mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 03:30:13 +00:00
fix: enhance performance of application support log cleanup using find -delete
This commit is contained in:
@@ -583,10 +583,15 @@ clean_application_support_logs() {
|
|||||||
((cleaned_count++))
|
((cleaned_count++))
|
||||||
found_any=true
|
found_any=true
|
||||||
if [[ "$DRY_RUN" != "true" ]]; then
|
if [[ "$DRY_RUN" != "true" ]]; then
|
||||||
for item in "$candidate"/*; do
|
# For directories with many files, use find -delete for performance
|
||||||
[[ -e "$item" ]] || continue
|
# This avoids shell expansion and individual safe_remove calls
|
||||||
safe_remove "$item" true > /dev/null 2>&1 || true
|
if ! find "$candidate" -mindepth 1 -delete 2> /dev/null; then
|
||||||
done
|
# 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
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user