Skip to content

Windows is full of links, and they are why folder sizes lie

Hard links, junctions and symbolic links all look like ordinary folders. How to find them and why they break size measurements.

5 min read

Windows uses links far more than most people realise, and every one of them breaks a naive size measurement. Understanding the three kinds explains most of the numbers that look wrong.

The three kinds

KindWhat it isMade with
Hard linkA second name for the same file datamklink /H
JunctionA folder that redirects to another foldermklink /J
Symbolic linkA link to a file or folder, can cross volumesmklink /D

Where Windows uses them already

  • WinSxS. Built almost entirely from hard links to files in System32, which is why walking it doubles the number.
  • Legacy profile folders. Application Data, My Documents and others are junctions kept for old software, and walking them counts AppData twice or loops.
  • Deduplicated volumes. On Windows Server, dedup makes many files share the same data.
  • Program Files\WindowsApps. Store apps share components through links.

Finding them

Get-ChildItem C:\ -Force -Recurse -Depth 3 -EA SilentlyContinue |
  Where-Object { $_.LinkType } |
  Select-Object LinkType, FullName, Target -First 30
# or the classic
dir /AL /S C:\Users\%USERNAME% 2>nul

LinkType tells you which kind. Anything reporting Junction in a user profile is almost certainly one of the legacy compatibility folders, and those should be skipped rather than followed.

Why this matters for cleanup

A tool that follows junctions can count the same data several times, report folders that do not exist as separate things, or in the worst case loop forever. A tool that treats hard links as separate files reports a component store at double its size and offers to reclaim space that was never there.

Using them yourself

Junctions are a legitimate way to move a stubborn cache folder to another drive, and the risks are real: an uninstaller can follow one and delete the target, a backup can copy the data twice, and an update can replace the link with a real folder. That trade is covered in moving programs to another drive.

Common questions

What is the difference between a junction and a symbolic link?

A junction redirects a folder and works only on local volumes. A symbolic link can point at a file or folder and can cross volumes, but needs elevation or developer mode to create.

Why do hard links make folder sizes wrong?

Because the same file data has several names, and a tool that adds up file sizes counts it once per name. WinSxS is built this way, which is why walking it reports roughly double its real size.

How do I find junctions on Windows?

In PowerShell, filter Get-ChildItem results where LinkType is set, or use dir /AL /S. Junctions in a user profile are usually the legacy compatibility folders and should be skipped.

Are junctions safe to use for moving folders?

For caches, usually. The risks are that an uninstaller can follow one and delete the target, a backup can copy twice, and an update can replace the link with a real folder.

Read next