1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 11:31:46 +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=()
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)
done
command find "$search_path" -mindepth "$min_depth" -maxdepth "$max_depth" -type d \
\( "${prune_expr[@]}" \) -prune -o \
\( "${target_expr[@]}" \) \
2>&1 | tee "$output_file.raw" > /dev/null
\( "${target_expr[@]}" \) -print -prune \
2> /dev/null > "$output_file.raw" || true
process_scan_results "$output_file.raw"
fi