Treesize for Linux

#!/bin/bash
# a simple script to generate a treesize listing on a linux box
# enter the directory to scan on the commandline
#
# created Friday 8 June 2012 by Elmars
echo FileCount  TotalKB Path
find $1 -type d |
while read dirlist
do
        filecount=`find $dirlist -type f |wc -l`
        ksize=`du --max-depth=0 -k $dirlist`
        echo $filecount $ksize
done
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s