I need to calculate the size of "real" files created under a folder (and its sub-folders) on an NTFS drive, where "real" is all files that are not present because of hard/soft-links, junctions etc.

Is there currently any tool that will do this? (command-line or graphical)

More details:

I guess such a capability will be useful only under the right circumstances, so, to avoid questions due to speculations on how I "really want to use it", I'll mention my use case in advance...

I've started using pnpm and I'm trying to evaluate actual disk usage. Given that the node_modules folder (when created by pnpm) contains folders that are links to pnpm's store, I know that files in those folders should not be counted. WinDirStat seems to ignore these folders, but I need to be sure about this.

Update (2019/12/02):

It seems to be more complicated than I thought. See this issue: Add size/disk usage benchmarks.

3 Answers 3


One way to do this would be to use FSCTL_GET_NTFS_FILE_RECORD. Links are properties of the file record.

As a bonus, it will enumerate things that the dir command won't show ($MFT, $LogFile, etc).

  • Sorry, that's not a tool. Thanks anyway.
    – Doc
    Dec 2, 2019 at 8:48
  • Hmm. I suppose I could wrap a CLI around it for you. But... To enumerate all the files on disk, especially using the MFT, requires admin privileges. If I made it, would you be comfortable running it? Dec 2, 2019 at 21:50

Won't something like this work for you?

(Get-ChildItem -Recurse 'node_modules' | 
? { $_.LinkType -eq $Null } | 
Measure-Object -Sum Length).Sum

$_.LinkType -eq $Null filters out all link types.


using du isn't enough to not chase links. you can use this code :

find /home/somedirectory/ -exec du -s {} + | awk '{total = total + $1}END{print (total / 1024 / 1024) "MB"}'

You must log in to answer this question.

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