disk uasage script

Hello,

I have the below script for disk usage but I would like to do disk usage for specific directories only.

Any one have any ideas on the best way to do this.

Regards

#!/bin/sh
tempfile="/tmp/available.$$"
trap "rm -f $tempfile" EXIT
cat << 'EOF' > $tempfile
{sum += $4 }
END { mb = sum /1024
gb = mb /1024
printf "%.of MB (%.2fGB) of available disk space\n" , mb, gb
}
EOF
df | awk -f $tempfile
exit 0

 

 

 

 

Top