How about "du -s DIR" where DIR the directory path. You can also use the --si flag to get a "human readable" version, or -b for the length in bytes. So something like: [ December 12, 2008: Message edited by: Charles Lyons ]
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )
Joined: Aug 13, 2008
Hi Charles Lyons,
I tried like
dir="/path/to/dir" size=`du -bs "$dir"`
but then i got size = 843M .
but i can't understand why there is "."(dot).
Actually i want only 843M
Please can you help me in that?
Joined: Mar 27, 2003
which should produce a result in bytes... that's the point of the -b argument. If it is still providing a result like 843M and not 843123456, then your version of du is different to mine (which is GNU coreutils v5.97). Check the manpage for your version. Unless you want the value with the k/M/G suffix?