diff options
Diffstat (limited to '.local/bin/scripts/file-search')
-rwxr-xr-x | .local/bin/scripts/file-search | 34 |
1 files changed, 17 insertions, 17 deletions
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; |