I'm using an rsync script to make incremental backups of a specific folder, in very much the same way Time Machine does. I'm very interested to know how large my backup destination folder is. However when I Get Info in the Finder, it tells me the size as if each hardlink is it's own unique file.

Is there a way I can calculate the actual disk space used by a folder, where hard-linked files aren't being counted again and again for each link?


The answer, partially assisted by the comment above, is to use du

Specifically, du -hs /path/to/folder/i/want/to/get/size/of

This counts hardlinked files only once. This is the parent folder of my hard-linked backups. So Finder tells me ~322 MB but du tells me ~171 MB. I don't think the 1000 vs 1024 issue is taken into account, but it's certainly close enough for my needs!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .