#!/bin/sh
#	Run du | xdu on multiple directories
#
# df . produces something like:
# wd 1: filesystem kbytes used avail capacity Mounted on
# wd 8: towerhost:/sci/local 943278 620858 228092 73% /tmp_mnt/usr/local

if [ -z $1 ]; then dot=.; fi
xy=0

for f in $* $dot; do
  df=`df $f | tail -1`
  if [ "$f" = "." ]; then
     dir=$(pwd)
  else
     dir=$f
  fi
  # Unfortunately the -name option doesn't seem to work
  du -h $dir | xdu -name "xdu: $dir $df" -g 600x800+$xy+$xy &
  xy=$(($xy + 20))
done
