Add flag to ignore hard links
Attempting to calculate the size of a directory after using tools which take advantage of hard links to reduce duplication across directories. It's not enough to only count hard links a single time in a run since those hard links all originate elsewhere and the originals won't be caught by dust or du.
Not even du has this feature afaik, so it would be a nice bonus to have from dust.
Alternatively, we can follow the behavior of du in that listing multiple directories allows us to use hard links from previous dirs in ignoring later dirs. When trying to filter out packages from pnpm on macos, for example, we can run dust -sh ./Library/pnpm ./our-folder and we should be removing all the hardlinks from ./our-folder that have been counted already from ./Library/pnpm.
So an option that ignores hard-links? I imagine it should ignore soft-links as well?
Do you think the links should be completely ignored or should they be listed but just as near-empty files ?
Yeah, an option to ignore all symbolic links would be nice. You can keep them, but list the size of the symbolic link instead of the content it points to, so it would show as a very small file. I guess the option would more accurately be named "don't follow symlinks" rather than ignore them.
I don't think this is possible.
https://unix.stackexchange.com/questions/122333/how-to-tell-which-file-is-original-if-hard-link-is-created
It is not possible to know which is a hard-link and which is the original
That's unfortunate. Perhaps then just a flag to ignore duplicate files? It would accidentally capture legitimate duplicates, but it would still solve a bit of the problem.
it already ignores duplicate files. If 2 files have the same inode it will only count them once.