Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'a little modification' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
a little modification
Authored by: fmarmar on Oct 21, '04 09:55:49PM
modifying a little the script you can use the power of -h option. Here are my personal version of script.

#!/bin/sh

# a shell script to print directory size summaries
# rick vannorman 20oct2004
# sub@neverslow.com
# modified by Felix Martin 22oct2004

du -ckh | awk '{
   dir = $0;                # preserve the input recordd
   x = gsub(/\//,"",dir);   # count the slashes, nesting level
   if (x != 1) next;        # ignore all but top level
   size = $1;        # convert 1024k block count to meg
   $1 = "";                 # blank the input field
   printf("\t%s\t%s\n",size,$0);  # display user friendly output
}'


[ Reply to This | # ]
a little modification
Authored by: Xeo on Oct 22, '04 12:55:20AM

As others have said, there is no reason to use this script when du has the ability to do this on it's own. Having it print out EVERY file only to filter it with awk is a waste of processing time.



[ Reply to This | # ]