#!/bin/bash # difference between two trees in size # assuming one tree has hardlinked files into the other tree # Ken Chasse math att sizone dott org [ -z "$2" ] && echo "Usage: $0 olddir newdir" && exit echo "total MB incr MB %age increase" du -xkm "$1" "$2" | expand - | sort -t / -k2 -k1.9,16n | gawk "/$1/"'{ if (d==2) { print "*"d":",ls,"\t0","\t0\t",ld} ls=$1; ld=$2; t=$1; d=2;} '"/$2/"'{ d=1; p=int(($1/(t+.00001))*100); gsub("'"$2"'","",$2); printf ("%6d\t%6d\t%6d\t%s\n", t, $1, p<9999?p:9999, $2); t=0 }' | sort -t " " -k2rn -k4