How can I find hard links on Windows?
All files are hard links, with link counts of at least 1.
This is why the files look the same. They are the same. What you seem to be looking for are files where there are more than one link to the file. There's very little that distinguishes a file with a link count greater than one from a file with a link count of one … except the link count (and some odd behaviour with respect to attributes and date stamps).
And that is dead easy to check with the find
command that is in Microsoft's SFUA utility toolkit, that runs in the Subsystem for Unix-based Applications:
find . -links +1
On Windows 7, use command:
fsutil hardlink list MyFileName.txt
It lists all hardlinks to file with name MyFileName.txt
.
Unfortunately, there is no way for the OS to find all your hardlinks without looking at each file.
For Explorer, you can download the very handy Link Shell Extension, which overlays files with hardlinks with a red shortcut-like arrow.
It also makes it rather effortless to create hardlinks, symlinks and junctions through Explorer's context menu.
Bonus chatter:
Technically, all files are hardlinks. Thus, you are really looking for files with more than one hardlink.
use finddupe:
finddupe -listlink c:\photos
A simple way for one-off checks: Are file attributes changing together?
If you want to test whether the files A
and B
are hard links to the same content and you do not want to install or run anything, open the Properties window of file A
and toggle for example its Read-only attribute. Now open Properties window of file B
to see whether change of the attribute (of file A
) took place also here. If yes, then the answer is positive.
Why this works? Because related hard links share the same set of file attributes and time stamps.
This having said, the same test can be made with time stamps of files, but they cannot be changed as easily as Read-only flag in order to perform the check.