Howdy,
Quick question. I want to get a summary of the total size one file type is taking up in a directory. For example, I want to know how much space *.jpg are utilizing under the pix directory. I've tried "du -ks *.jpg" but this only displays the size of each individual jpg file, not the sum of all the jpgs. Any help would be great!
here is a script you need to copy:
$ cat total.sh
#!/bin/sh
File=$1
let y=0
for x in `du -ks *."$File" | awk '{print $1}'`
do
let y=`expr $y+$x`
echo $y
done | echo "total $File files are ` tail -1 `KB "
exit
and here it is in action:
$ ./total.sh doc
total doc files are 288KB