Re: Why is there difference between sum sizes of individual files and output by du?



Prasad wrote:
Hi All,

This is what I have noticed. When I manually add the sizes of
individual files in a directory the sum is different than what is
produced by du on the same directory.

( /home/Prasad/programs/c/lsp/IPC/message_queue/ contains no
directories within)
[Prasad@prasadjoshi my_du]$ ls -al
/home/Prasad/programs/c/lsp/IPC/message_queue/
total 32
drwxrwxr-x 2 Prasad Prasad 4096 Jan 1 18:59 .
drwxrwxr-x 4 Prasad Prasad 4096 Jan 8 18:47 ..
-rw-rw-r-- 1 Prasad Prasad 971 Jan 1 18:59 first_receiver.c
-rw-rw-r-- 1 Prasad Prasad 1505 Jan 1 18:58 first_sender.c
-rwxrwxr-x 1 Prasad Prasad 5642 Jan 1 15:09 rcv
-rwxrwxr-x 1 Prasad Prasad 6115 Jan 1 15:09 send

971 + 1505 + 5642 + 6115 = 14233
14233 / 1024 = 13

[Prasad@prasadjoshi my_du]$ du
/home/Prasad/programs/c/lsp/IPC/message_queue
28 /home/Prasad/programs/c/lsp/IPC/message_queue

Why is there so much of difference?

Educated guess: your version of du prints in units of 512 bytes rather than in units of 1024 bytes, as the standard du would do.

--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

.



Relevant Pages

  • Re: =sumif
    ... >> I need to sum the combined quantities of the same box sizes in B33 to B36 ... >> against the different box sizes in A33 to B36 ...
    (microsoft.public.mac.office.excel)
  • Re: sizeof unpadded struct size
    ... sum the sizes of the members of the struct. ...
    (comp.lang.c)
  • Re: Help needed with IF DSum in query
    ... The expression you entered contains invald syntax, or you need to enclose ... Could you explain in words which records you want to sum? ... sizes XS, S, M, L, XL, XXL and the user types X, you'll be summing all three X ...
    (microsoft.public.access.gettingstarted)
  • Reduce Powerpoint File Size
    ... The sum of the sizes of the 6 ... removing graphics content from the slide master, ... How can the sum of the parts be three times ...
    (microsoft.public.powerpoint)
  • Re: concatenate files
    ... Dave wrote: ... that the length of the file when concatonated, is not simply the sum of the lengths of the individual files. ...
    (comp.lang.tcl)