I'm using this method by Dave DeLong to calculate the size of a folder using the Carbon File Manager API:
(Its the first method there)
The issue I'm having is that some folders (.app bundles in my case) are not reporting the correct size. For example, DiskWarrior is 8.2MB, and the method reports 6.6MB
Any ideas on why this is happening?
THANKS
The Finder will report file sizes rounded to the nearest multiple of the block size (usually 4 KB) followed by the real size in bytes, and many (most) applications are bundles of files, so the true size of the application may be far smaller than the size shown as the first ("on disk") value.
You can test this out by doing something (in the Terminal) like:
echo -n 'foo' > foo.txt
If you Get Info on this file in the Finder, it will report the size as "4 KB on disk (3 bytes)".