Quickly view all symbolic links, junctions points and hard links in a folder

When you migrating a file server and transfering data, you may need to recreate junction points, as they cannot be copied using (for example) Robocopy. This makes it a must to know where you have junction points, and that is where PowerShell and even plain old cmd.exe DIR come to the rescue.
Published on Tuesday, 2 June 2020

How to find all symbolic links, junction points and hard links in a folder in Windows Server quickly? Use dir /al /s /b.

Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

Dir displays a list of files and subdirectories in a directory. The /A switch is display files with specified attributes, and L is for Reparse Points attribute. Use this in one switch: /al.

Use /s to display files in the specified directory and all subdirectories (e.g recursive), and /b to leave out heading information and summary.

Give it a try:

C:\>dir /al /b
Documents and Settings

In PowerShell you find out about junction points, symbolic links and hard links using Get-ChildItem's LinkType filter:

Get-ChildItem . -Recurse -Force `
  | ?{ $_.LinkType } `
  | Select FullName, LinkType, Target

Or an example without recursive:

PS C:\Users\Jan Reilink> Get-ChildItem . -Force `
>>   | ?{ $_.LinkType } `
>>   | Select FullName, LinkType, Target

FullName                              LinkType Target
-------- -------- ------
C:\Users\Jan Reilink\Application Data Junction C:\Users\Jan Reilink\AppData\Roaming
C:\Users\Jan Reilink\Cookies          Junction C:\Users\Jan Reilink\AppData\Local\Microsoft\Windows\INetCookies
C:\Users\Jan Reilink\Local Settings   Junction C:\Users\Jan Reilink\AppData\Local
C:\Users\Jan Reilink\My Documents     Junction C:\Users\Jan Reilink\Documents
C:\Users\Jan Reilink\NetHood          Junction C:\Users\Jan Reilink\AppData\Roaming\Microsoft\Windows\Network Shortcuts
C:\Users\Jan Reilink\PrintHood        Junction C:\Users\Jan Reilink\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
C:\Users\Jan Reilink\Recent           Junction C:\Users\Jan Reilink\AppData\Roaming\Microsoft\Windows\Recent
C:\Users\Jan Reilink\SendTo           Junction C:\Users\Jan Reilink\AppData\Roaming\Microsoft\Windows\SendTo
C:\Users\Jan Reilink\Start Menu       Junction C:\Users\Jan Reilink\AppData\Roaming\Microsoft\Windows\Start Menu
C:\Users\Jan Reilink\Templates        Junction C:\Users\Jan Reilink\AppData\Roaming\Microsoft\Windows\Templates