http://qs1969.pair.com?node_id=54313


in reply to Disk Space used by a folder (and sub folders)

That will give you the total size of files, but not the total space used on the filesystem for the files. If you care about that distinction, you'll need to determine what the BLOCKSIZE is on the filesystem that the files reside on, and round each file's size up to the nearest multiple of that blocksize before summing.

As for determining blocksize.. that varies with OS. It's often 512 bytes, but can be quite a bit larger depending on how the filesystem is configured.