Plugin to quickly locate all files hard linked together

May 20, 2008
Elkridge, MD, USA
I use many hard-linked files for various purposes, and at various times need to find all of a files siblings. Due to NTFS design, this requires an exhaustive search of the FS. I wonder if one could use a FOLDERMONITOR thread to maintain a database of hard-linked objects (one would need to build the database on first activation, or to refresh it). This database would also be very valuable for backup, migration, etc.
Oct 18, 2009
I can't help with code, but possibly an alternative suggestion.

I use a number of different image editing programs such as PaintShop Pro and Photoshop Elements. Those programs include a huge number of scripts, bitmaps, sample images, etc. I have 60GB SSD's for my C:\ drive and those clutter up the drive, so I use junctions to move all those to a different physical drive. I normally use junctions for folders, not individual files.

Whenever I create a junction, I rename the original folder by adding a minus, e.g., MSO Cache => -MSO Cache. In the parent folder I add a file called JUNCTION LIST.TXT That contains entries in the format:

C:\MSO Cache was replaced with a junction to S:\<whatever>\MSO Cache
MKLINK <the specific code that was used to create the junction>

I then use that code to actually create the junction.

In the junction target I also put the same file JUNCTION LIST.TXT

If you want to, you can put the contents of all the JUNCTION LIST.TXT files into a single file so you'll have a record in one place.


Senior IT Security Consultant
May 28, 2008
If you are just looking at file hard links... not worried with directory junctions and such... then findlinks can do it, so I can't image why a plugin could not. Then again if findlinks works for you no need for a plugin unless you just want a cleaner output withOUT any processing of the output of findlinks... or just want a challenge. :)

[C:\Utils]FindLinks.exe "c:\Program Files (x86)\JPSoft\TCMD15\tcc.exe"

FindLinks v1.0 - Locate file hard links
Copyright (C) 2011 Mark Russinovich
Sysinternals -

c:\program files (x86)\jpsoft\tcmd15\tcc.exe
Index: 0x0007FA3B
Links: 4

Linking files:
c:\Program Files (x86)\JPSoft\TCMD15\4nt.exe
c:\Program Files (x86)\JPSoft\TCMD15\test1.exe
c:\Program Files (x86)\JPSoft\TCMD15\test3.exe
c:\Program Files (x86)\JPSoft\TCMD15\test2.exe​

A more extensive util is ln from:

[C:\Utils]ln -l "c:\Program Files (x86)\JPSoft\TCMD15\tcc.exe" | tail /n+2
c:\Program Files (x86)\JPSoft\TCMD15\4nt.exe
c:\Program Files (x86)\JPSoft\TCMD15\test1.exe
c:\Program Files (x86)\JPSoft\TCMD15\test3.exe
c:\Program Files (x86)\JPSoft\TCMD15\test2.exe
There is also a graphical shell extension for the ln util above, but I have not used it:
Last edited:
May 20, 2008
Syracuse, NY, USA
I now have LINKSTO in my SYSUTILS plugin. Doing it for one file (as in my previous post) was almost trivial.
p:\4sysutils\release> linksto "c:\Program Files\Common Files\microsoft shared\DAO\dao360.dll"
\Program Files\Common Files\microsoft shared\DAO\dao360.dll
Finding all such on a volume is a different story. I've written a version of DU.EXE which can output a list of them to a file (whick makes sense after it's sorted). That's very slow and I doubt it can be made fast ... you have to plow through all the files. I'll try adding a @LINKSTO[] function. If that works out, the user might try something like ...
do f in /s /a:-d /d"g:\" * ( if %@LINKSTO["%@full[%f]"] GT 1 linksto "%@full[%f]" )
... or something like that.
May 20, 2008
Syracuse, NY, USA
Yeah, that works and it isn't too bad. It finds about 1000 in c:\ in about 17 seconds.

Occasionally, access is denied. Should I print an error message or silently continue?

Similar threads