On Wed, 8 Oct 2008, lhmwzy wrote:
 > OK.It's my mistake.
 > Improve it again:
 > 
 > #!/bin/sh
 > find $1 -type f -ls  | awk '{j += $7} END {printf("%.2fM\n",j/1024/1024)}'

Sure.  Here it runs about 7% faster precalculating one division:

$ time find . -type f -ls  | awk '{j += $7} END {printf("%.2fM\n",j/1048576)}'
        2.69 real         0.64 user         1.21 sys
6586.34M

 > > $ du -d0 .
 > > 6781976 .
 > >
 > > Took 1.5 seconds, and comes to 69447434424, ie bytes allocated for those

And my mistake, transcribing from the calculator: should be 6944743424.

cheers, Ian
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to