You are here: Saotn.org » Windows Server » Quickly view all symbolic links, junctions points and hard links in a folder

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

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

When you are migrating a file server to a new server, and transfer data to your new SMB share, you may need to recreate junction points, as they can’t be copied using (for example) Robocopy. Therefore it’s a must to know where you have junction points, and that’s where plain old DIR comes to the rescue.

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 can use LinkType as a filter:

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

Leave a Reply

Your email address will not be published. Required fields are marked *