On Tue, Mar 06, 2007 at 10:01:38PM +0100, Nigel Henry wrote:
This is a silly question perhaps. I have my soundfiles in a directory named Sounds Library, this contains many subdirectories, which contain the .wav files.
What command can I use to find out the disk space this directory is taking up, including all the files that are in the subdirectories?
Nigel.
I wrote this a long time back for myself. It might suffice your needs. Cut paste the following code in a file say: dirsize, chmod +x dirsize and execute.
#-CUT & PASTE--------------------------------------------------------- #/bin/bash
IGNORE='proc /dev /sys /initrd /mnt /media'
# This script produces a list of dir size. Selects only MB and above entries.
# Arg is the dir name else pwd is selected if [ -z "$1" ]; then SDIR=`pwd` OutPut=/tmp`pwd` else SDIR=$1 OutPut=/tmp/${USER}/${1} fi
echo "Output file is ${OutPut}/dir-size.out"
mkdirhier ${OutPut} && ls -lAR --si --ignore="${IGNORE}" ${SDIR}|grep 'total' -B1|grep '^total[[:space:]][0-9.]*[mMgG][[:space:]]*' -B1 >${OutPut}/dir-size.out 2>&1 echo -e "\nTotal Size Of Dir $SDIR" >>${OutPut}/dir-size.out 2>&1 du -ach ${SDIR}|grep "[[:space:]]total$" >>${OutPut}/dir-size.out 2>&1
less ${OutPut}/dir-size.out #-CUT & PASTE---------------------------------------------------------