webif/var/mongoose/html/img/channels/dedup

24 lines
509 B
Plaintext
Raw Normal View History

#!/bin/sh
#[ ! -f checksums ] && for f in *.png; do
# [ -h "$f" ] && continue
# [ -f "$f" ] || continue
# sha1sum "$f"
#done > checksums
cat checksums | while read line; do
sum=`echo $line | awk '{print $1}'`
file="`echo $line | cut -d\ -f2-`"
[ -h "$file" ] && continue
set -f
echo "$file..."
grep "^$sum" checksums | while read dup; do
file2="`echo $dup | cut -d\ -f2-`"
[ "$file" = "$file2" ] && continue
echo "$file -> $file2"
rm -f "$file2"
ln -s "$file" "$file2"
done
set +f
done