i using du
function output directory size file , move excel file add total. possible output size of directory in mb (even if size in kb or gb):
e.g. if file size 50kb output show 0.048mb
i'm aware of du -h
haven't been able maintain size in mbs if size larger 1024, since it's switches 1g. du -m
not show m (for megabytes) next value isn't human friendly.
thanks in advance, j
it's -m
option. so, example:
$ du -s -m <my_directory_here>
update
oh... want "m" printed after number of megabytes. here are:
$ du -s -m /usr/local | sed 's/^\([0-9]*\)\(.*\)$/\1m \2/'
or...
$ du -s -m /usr/local | sed 's/^\([0-9]*\)\(.*\)$/\1mib \2/'
or...
$ du -s -m /usr/local | sed 's/^\([0-9]*\)\(.*\)$/\1 megabytes \2/'
etc.
update2
if want fractions use du -k
print kib , then:
$ du -s -k * | awk '{printf "%.3f mib %s\n", $1/1024, $2}' 43.355 mib bin 0.008 mib etc 0.562 mib include 5.836 mib lib 0.008 mib man 0.004 mib mysql 2259.738 mib mysql-5.5.27-osx10.6-x86_64 45.711 mib share 340.641 mib texlive
Comments
Post a Comment