I want to get the sum of file sizes in a folder excluding hard links.
I have a bunch of folders with a bunch of files. A lot of the files are hard linked amongst themselves (these files were created via rsnapshot). I want to get the actual size occupied by the files. Seems like du counts each hardlink as the size occupied by the destination file, so I get a bloated result. Also, du doesnt seem to have an option to exclude hard links.
Any ideas on how to do this?
Thanks a lot!
Try "du -ah --max-depth=1". It will show 0 size for links so your total size will not be affected.