Ubuntu – Summarize file sizes of a directory structure

file sizels

I have written a small backup script with rsync. I would like to monitor its progress by comparing the total file sizes on the source and destination directories. du Is inaccurate because it measures the disk usage, not the file size, and the disk usage varies between file systems.

How can I summarize the file sizes of an entire directory structure?

Best Answer

Perhaps the --apparent-size option for du will do what you are after:

       print apparent sizes,  rather  than  disk  usage;  although  the
       apparent  size is usually smaller, it may be larger due to holes
       in (`sparse') files, internal  fragmentation,  indirect  blocks,
       and the like

That should remove the dependence on file system block sizes or other metadata.