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

fix: optimize find command expressions in scan_purge_targets function

This commit is contained in:
tw93
2026-02-02 11:21:11 +08:00
parent 7514680e6b
commit 67c9d16b13

View File

@@ -422,14 +422,14 @@ scan_purge_targets() {
local target_expr=() local target_expr=()
for i in "${!purge_targets[@]}"; do for i in "${!purge_targets[@]}"; do
target_expr+=( -name "${purge_targets[$i]}" -print ) target_expr+=(-name "${purge_targets[$i]}")
[[ $i -lt $((${#purge_targets[@]} - 1)) ]] && target_expr+=(-o) [[ $i -lt $((${#purge_targets[@]} - 1)) ]] && target_expr+=(-o)
done done
command find "$search_path" -mindepth "$min_depth" -maxdepth "$max_depth" -type d \ command find "$search_path" -mindepth "$min_depth" -maxdepth "$max_depth" -type d \
\( "${prune_expr[@]}" \) -prune -o \ \( "${prune_expr[@]}" \) -prune -o \
\( "${target_expr[@]}" \) \ \( "${target_expr[@]}" \) -print -prune \
2>&1 | tee "$output_file.raw" > /dev/null 2> /dev/null > "$output_file.raw" || true
process_scan_results "$output_file.raw" process_scan_results "$output_file.raw"
fi fi