# !this is not a finished script, just commands taken from history and edited!
# It might work as is, but hasn't been tested in this form.
# Check ~/Z-partial-by-size before before doing the gzip step.

fnd . -type f | xa du --block-size=1 > ../Z-du
fnd . -type f | xa du -b > ../Z-size 
paste <(kut 1 <../Z-du) ../Z-size > ../Z-du-size
perl -ne 'chomp; my ($du, $size, $name) = split /\t/, $_; print join("\t", $du, $size, $name), "\n" if $du < $size * 0.9' < ../Z-du-size > ../Z-partial
< ../Z-partial sort -n > ../Z-partial-by-size
I=1 ; N=`wc -l <../Z-partial-by-size` ; < ../Z-partial-by-size tac | kut 3 | while read A; do echo $I / $N; gzip -1 "$A"; I=$[$I+1]; done
