Unexpected Symbolic Link Following During Searches on External Drives

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
zupermario
Junior Member
Junior Member
Posts: 37
Joined: 2011-04-01, 21:11 UTC

Unexpected Symbolic Link Following During Searches on External Drives

Post by *zupermario »

Hello everyone,

I'm experiencing a significant and concerning issue with Total Commander when performing searches on external hard drives connected via USB.

Years ago, when junction points and symbolic links had become prevalent on our computers, I raised this very problem, and unfortunately, it seemed no reliable or elegant solution was reached. You can find the previous discussion here: https://www.ghisler.ch/board/viewtopic.php?t=34151

Today, I've realized that the problem is still very much present and highly dangerous, given the numerous default symbolic links in any Windows installation. The most serious aspect is that, while thinking I'm working on an external drive (which was the system drive of another computer), if I perform a search and then act on the resulting files, I inadvertently end up working on MY OWN FILES ON DRIVE C:.

Let me remind you what happens: when I search an external drive that contains default Windows symbolic links, such as "All Users," Total Commander appears to follow these links. Although the displayed path still indicates the external drive's letter (e.g., E:\All Users), the search results actually include files from my local C: drive. For instance, "All Users" points to C:\ProgramData. This means a search initiated on the external drive implicitly ends up including results from my local C:\ProgramData folder, even though the displayed path suggests I'm still on the external drive.

The critical consequence is that any subsequent actions on these search results (e.g., deleting or copying files) inadvertently affect my local system, instead of being confined to the external drive 😱 This is quite alarming.

The files in the attached screenshot, which are the subject of my search, are all my files on my system drive C:, not files from drive H 😥.
Image: https://ibb.co/s95FCFYc


After so many years, and with symbolic links and junction points now part of everyday computing, has a better solution than those previously proposed finally been achieved to prevent Total Commander from following these links during searches on external drives? My priority is to ensure all operations remain strictly within the connected external drive.

Thank you for your help!
User avatar
Dalai
Power Member
Power Member
Posts: 10042
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Unexpected Symbolic Link Following During Searches on External Drives

Post by *Dalai »

Well, what do you suggest TC should do? If TC wouldn't follow links when searching, I'm sure that the complaints would come pretty quickly... Even if there was an INI setting similar to IgnoreLinks people would forget about it or forget to change its value based on the current use case.

Honestly, I'd avoid having symbolic links and junctions on external drives unless absolutely necessary.

Maybe it would help if one of the NTLinks or NL_Info plugins had a field which could determine if a link and its target are on the same volume. Since I think that's very easy to implement, I made a suggestion here. Until this is implemented (if at all) you could use something like this to avoid having links with a target on a different drive in the result list.
Find Files, tab Plugins:

Code: Select all

[X] Search in plugins     Combine with AND
 
tc      | path      | regex | ^H:
ntlinks | RP_Target | regex | ^H:
Replace H: with any drive you want. Note that TC will still follow links when searching. But only those paths/links that point to a target within the same volume are shown.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50934
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Unexpected Symbolic Link Following During Searches on External Drives

Post by *ghisler(Author) »

As mentioned by Dalai, you can use the flag IgnoreLinks in wincmd.ini to control when to follow links.
Allows you to ignore hard links (junctions, reparse points) to directories in various functions. Note: The function "Synchronize dirs" uses a separate option "SyncIgnoreJunctions".
Sum of:
1: copy/move/calculate occupied space
2: internal packers (zip, tar)
4: branch view
8: find files (except when using Everything), re-scan tree
16: ignore links even when they are selected in the current directory. Otherwise only links in selected subdirectories are ignored.
So if you want to not follow them only when searching, set it to
IgnoreLinks=8
Author of Total Commander
https://www.ghisler.com
zupermario
Junior Member
Junior Member
Posts: 37
Joined: 2011-04-01, 21:11 UTC

Re: Unexpected Symbolic Link Following During Searches on External Drives

Post by *zupermario »

ghisler(Author) wrote: 2025-06-24, 13:04 UTC So if you want to not follow them only when searching, set it to
IgnoreLinks=8
Very good! So, there's an option now to ignore junction points. When I posted the problem ages ago, it didn't exist! I'm really happy about this and will go test it immediately. Thank you very much!
zupermario
Junior Member
Junior Member
Posts: 37
Joined: 2011-04-01, 21:11 UTC

Re: Unexpected Symbolic Link Following During Searches on External Drives

Post by *zupermario »

Dalai wrote: 2025-06-24, 10:58 UTC Honestly, I'd avoid having symbolic links and junctions on external drives unless absolutely necessary.
Unfortunately, that's not something I can choose. If I'm given system drives from other computers that have Windows installed, I'll inevitably find at least the default junction points.
Dalai wrote: 2025-06-24, 10:58 UTC Maybe it would help if one of the NTLinks or NL_Info plugins had a field which could determine if a link and its target are on the same volume.
Thanks for the suggestion! In the old thread, someone actually responded with 'unfortunately this won't prevent TC from entering junctions during search.' that's why I brought up the question again. Fortunately, I've now learned about the 'IgnoreLinks' option!
User avatar
Dalai
Power Member
Power Member
Posts: 10042
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Unexpected Symbolic Link Following During Searches on External Drives

Post by *Dalai »

zupermario wrote: 2025-06-24, 14:41 UTCWhen I posted the problem ages ago, it didn't exist!
The flag 8 (ignore links during search) has been available since TC 8.51 (around 2014). The IgnoreLinks option itself is even older. Curiously, you even mentioned IgnoreLinks in the old thread, although only in the post title. Anyway, I'm glad this option can be of help to you.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50934
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Unexpected Symbolic Link Following During Searches on External Drives

Post by *ghisler(Author) »

Maybe they had set it to 1 and wondered why links were not ignored when searching.
Author of Total Commander
https://www.ghisler.com
Post Reply