Plugin to quickly locate all files hard linked together

May 20, 2008
3,515
4
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
362
17
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.
 

gwgaston

Senior IT Security Consultant
May 28, 2008
57
1
SC
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. :)

https://technet.microsoft.com/en-us/sysinternals/hh290814?f=255&MSPPError=-2147217396

[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 - www.sysinternals.com

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:

http://schinagl.priv.at/nt/ln/ln.html#enumhardlinks

[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:

http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html#linkproperties
 
Last edited:
May 20, 2008
11,400
99
Syracuse, NY, USA
I now have LINKSTO in my SYSUTILS plugin. Doing it for one file (as in my previous post) was almost trivial.
Code:
p:\4sysutils\release> linksto "c:\Program Files\Common Files\microsoft shared\DAO\dao360.dll"
\Program Files\Common Files\microsoft shared\DAO\dao360.dll
\Windows\winsxs\x86_microsoft-windows-m..s-components-jetdao_31bf3856ad364e35_6.1.7600.16385_none_7b8c1dc4ef873d90\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 ...
Code:
do f in /s /a:-d /d"g:\" * ( if %@LINKSTO["%@full[%f]"] GT 1 linksto "%@full[%f]" )
... or something like that.
 
May 20, 2008
11,400
99
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
Thread starter Title Forum Replies Date
Joe Caverly 64-bit Plugin development using PureBasic Plugins 15
R New Plugin Plugins 0
Alpengreis elevated plugin questions Plugins 3
fpefpe utf-8 support in sdk/plugin api Plugins 4
S How to? Can @DU function in 4Utils64 plugin somehow cater for dirs with spaces? Plugins 3
vefatica Plugin access to arrays? Plugins 4
vefatica How big is a plugin's parameter buffer? Plugins 5
C @knownpath plugin Plugins 0
Charles Dye Updated OSD plugin Plugins 0
Joe Caverly C# plugin framework for JPSoft's TCC Plugins 0
dcantor Help for newest version of TEXTUTILS plugin Plugins 10
dcantor UISTUFF plugin missing help topic Plugins 12
M How to? Use SafeChars plugin... Plugins 2
dcantor Error in SAFECHARS plugin v 1.9.0 Plugins 2
dcantor Request for documentation for ISO8601 plugin Plugins 4
vefatica Possible with a plugin? Plugins 6
dcantor Inconsistency between textutils plugin and wrap utility Plugins 2
M (Stupid?) Problem with 64-bit 4Utils plugin... Plugins 3
H Latest ISO8601 plugin? Plugins 1
Charles Dye New plugin: QKeys Plugins 34
S Documentation Plugin everything.dll Plugins 5
newbie How to? Multi-plugin installation errors, Re: FedUtils8 Plugins 7
vefatica Plugin -> thread -> Command() -> Ctrl-C? Plugins 20
Charles Dye A weirdoid plugin question Plugins 6
M SafeChars plugin misbehaving... Plugins 3
M A weird error re a plugin... Plugins 0
vefatica Plugin dilemma Plugins 2
fpefpe Documentation Plugin API/SDK Plugins 3
C Looking for Vince's old 4UTILS plugin for TCMD v8 Plugins 1
S DESKTOP plugin - anyone ? Plugins 0
C How to? a plugin to sort Outlook Express "rules" Plugins 0
M ISO Plugin: Yes, it's wonderful, but it could be yet more wonderful... Plugins 7
M The ISO plugin is wonderful, but it lacks a little something... Plugins 22
Charles Dye Beta plugin: HidePasswords Plugins 3
M ISO8601 Plugin not "reporting" errors to TCC... Plugins 4
Frank 4console plugin Plugins 4
S WAD ISO8601 Plugin Plugins 15
Joe Caverly Plugin and 64-bit TCC Plugins 3
C Problem with FixNames plugin Plugins 9
dcantor Suggestion and request for DBF plugin Plugins 6
dcantor Suggestion for SafeChars plugin Plugins 7
M Charles, I just installed the "new" SafeChars plugin, ... Plugins 5
M A problem with the SafeChars Plugin... Plugins 30
S WHICHWIN (sysutils plugin) Plugins 13
M A (presumbly pretty simple) SafeChars plugin request... Plugins 2
M A "SafeChars" plugin request... Plugins 2
S ISO 8601 plugin enhancement Plugins 6
D UNKNOWN_CMD in Plugin Plugins 13
C Looking for isemailaddress[string] plugin Plugins 7
S ISO8601 Plugin Plugins 4

Similar threads