From "man du" :
Summarize disk usage of each FILE, recursively for directories.
So, "du" gives you the USED space in a directory. To get the free space you need "df". This is an example script (invoke with "script.sh /some/directory"):
while [ $R -ne 0 ]; do
df $DIR 1>/dev/null 2>&1
It will not do quite everything for you. The output of "df" is human readable, so I would suggest you read "man tail" and "man cut" and "man tr" and figure out a way of extracting from the lines df outputs exactly what you need.