Symbolic links and directory junctions
With dir
, you can list all symlinks and junctions in a specific folder and its subfolders.
If you pipe the result to find
, you can filter out any links that do not interest you.
Examples:
To find all symlinks and junctions on C:
that point to C:\Users
, use
dir C:\ /al /s | find /i "[C:\Users]"
To find all symlinks and junctions on C:
that point to C:\Users
or one of its subdirectories, use
dir C:\ /al /s | find /i "[C:\Users\"
Unfortunately, this won't tell where the files are located. grep for Windows gives better results:
Examples:
dir C:\ /al /s | grep -Pi "Directory of|\[C:\\Users\]"
dir C:\ /al /s | grep -i "Directory of\|\[C:\\Users\\\\"
Note that you have to escape the brackets, double the backslashes and quadruple a trailing backslash.
Hard links
Because hard links are directly associated to a file by the file system, it's much easier/faster to find them.
To find all hard links to file
, use
fsutil hardlink list file
2
By alias, do you mean hard links and/or symlinks?
– Dennis – 2012-07-26T15:49:08.640I'm mainly looking for symlinks, but both, if that's possible... – FlyingMolga – 2012-07-26T18:57:35.070