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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user