Skip to content

Commit

Permalink
Commit some old files: script for finding duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
losvald committed Oct 9, 2015
1 parent 030c8d1 commit b68f13c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/jpg-finddup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
usage() { echo "Usage: $0 [-d <locate_dbpath>] [-i <ignore_regex>]"; exit $1; }
while getopts "d:i:I:" o; do
case "$o" in
d)
d=${OPTARG}
[ -f "$d" ] || usage 1 ;;
i) i+=" -e '${OPTARG}'" ;;
I) I=${OPTARG} ;;
*) usage 1 ;;
esac
done
shift $((OPTIND - 1))
[ -n "$d" ] && d="-d $d"
if [ -n "$I" ] && [ -f "$I" ]; then
i+=$(cat "$I" | grep -v '^$' | sed "s/.*/-e '&'/" | tr '\n' ' ')
fi
[ -z "$i" ] && i=" -e '^"'$'"'"
echo "i=$i"
echo locate $d -i "'*.jpg'" -e
echo egrep -v $i
locate $d -i '.jpg' -e | egrep -v "$i" \
| xargs -d '\n' stat --printf '%10i %n\n' | sort -s | uniq -w 10 | cut -c 12- \
| xargs -d '\n' jpghash 2>/dev/null | sort | uniq -D -w 40

0 comments on commit b68f13c

Please # to comment.