From 927fbaf9a7b00d3fa507a91e2277153c1939c502 Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 5 Dec 2020 04:45:38 -0500 Subject: .local/bin/scripts/file-search: Drop mlocate --- .local/bin/scripts/file-search | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to '.local') diff --git a/.local/bin/scripts/file-search b/.local/bin/scripts/file-search index bb744e5..2da2bf5 100755 --- a/.local/bin/scripts/file-search +++ b/.local/bin/scripts/file-search @@ -1,27 +1,27 @@ #!/bin/sh -eu cache=/tmp/file_search_results.cache -append() { find "$1" -maxdepth 1 -printf "%p\n"; } -appendRecursive() { find "$1" -printf "%p\n"; } +append() { find "$1" -maxdepth 1 -printf "%p\n" 2> /dev/null || true; } +appendRecursive() { find "$1" -printf "%p\n" 2>/dev/null || true; } removeDuplicates() { awk '!visited[$0]++' "$1" | sponge "$1"; } { [ ! -f "$cache" ] \ || [ "${1:-}" = "update" ]; } \ - && locate -ie \ - "$HOME"/.vim \ - "$HOME"/Music \ - "$HOME"/Books \ - "$HOME"/Videos \ - "$HOME"/Documents \ - "$HOME"/Downloads \ - "$HOME"/Pictures \ - "$HOME"/.local/bin \ - "$HOME"/.config/awesome \ - "$HOME"/.config/systemd \ - "$HOME"/.local/share/Trash \ - "$HOME"/.local/share/applications \ - > "$cache" \ - && { append "$HOME"; } >> "$cache" + && { + append "$HOME"; + append "$HOME"/.local; + append "$HOME"/Desktop; + append "$HOME"/Shares/Projects; + appendRecursive "$HOME"/.vim; + appendRecursive "$HOME"/.local/bin; + appendRecursive "$HOME"/.config; + appendRecursive "$HOME"/Music; + appendRecursive "$HOME"/Books; + appendRecursive "$HOME"/Videos; + appendRecursive "$HOME"/Documents; + appendRecursive "$HOME"/Downloads; + appendRecursive "$HOME"/Pictures; + } > "$cache" [ "${1:-}" = "update" ] && removeDuplicates "$cache" && exit; -- cgit v1.2.3