config: implement duploc
This commit is contained in:
parent
e74af0904b
commit
dc536f0090
|
@ -65,7 +65,7 @@ alias uloc='noglob sudo updatedb && loci'
|
|||
locei() { locate --all --basename "\\$1" "$@" | fselect }
|
||||
alias loce='noglob locei'
|
||||
# locate all
|
||||
alias loca='noglob sudo updatedb -l 0 --prunenames "" --prunefs "tmpfs sysfs debugfs" --prunepaths "/var/cache" --debug-pruning -o /var/cache/locate-all.db && loci --database /var/cache/locate-all.db'
|
||||
alias loca='noglob sudo updatedb -l 0 --prunenames "" --prunefs "tmpfs sysfs debugfs" --prunepaths "" -o /var/cache/locate-all.db && loci --database /var/cache/locate-all.db'
|
||||
|
||||
# ZOXIDE {{{1
|
||||
alias c=z
|
||||
|
|
|
@ -145,6 +145,7 @@ export KEYTIMEOUT=1
|
|||
setopt correct
|
||||
CORRECT_IGNORE="[_|.]*"
|
||||
# command history - https://unix.stackexchange.com/a/273863
|
||||
# TODO always much shorter
|
||||
HISTSIZE=100000
|
||||
SAVEHIST=$HISTSIZE
|
||||
setopt inc_append_history
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Delete files under current or given path which exist elsewhere as listed in the locate database
|
||||
# Matches first by name, then by checksum
|
||||
# TODO
|
||||
find "$@" -size +50M | while read filepath
|
||||
do f="$(basename "$filepath" | synct-unarchive)"
|
||||
# Matches first by name, then by checksum (currently inefficiently via md5)
|
||||
find "$@" -size +50M -type f | while read filepath
|
||||
do target="$(basename "$filepath" | synct-unarchive)"
|
||||
highlight "$filepath"
|
||||
locate -b "$f"
|
||||
locate -b "$target" | while read existing
|
||||
do test "$(realpath "$target")" != "$(realpath "$existing")" -a -f "$existing" -a "$(md5sum "$existing" | cut -d\ -f1)" = "$(md5sum "$filepath" | cut -d\ -f1)" && echo "Found duplicate at $existing" && rm -vi "$filepath" && break
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue