Show when inside a junction/symlink folder

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
jj42
Junior Member
Junior Member
Posts: 50
Joined: 2007-08-18, 23:17 UTC

Show when inside a junction/symlink folder

Post by *jj42 »

When a folder is actually a junction / symlink linking to another physical folder, it is easy to see with the arrow overlay.
But once you enter that junction / symlink or a subfolder there, nothing visually indicates that you are actually working in a different place.

For example, you have a junction e:\dir1\folder1 which links to f:\dir2\folder2. If you are in "e:\dir1" you will see the arrow overlay on the folder symbol. Now enter the "folder1", and the path shows "e:\dir1\folder1". There is no indication that if you change or delete a file there, you will actually change it in "f:\dir2\folder2".

Can I get TC to make it clear when I'm inside such a linked path?

I'd love it if the "target" (f:\dir2\folder2) would be visible after the path (e:\dir1\folder1)
Alternatively, just showing some visual hint to be careful could help already. This could be an icon of some sort in the path or on the tab, or a different background colour for the tab or path. Or adding a word like "symlink" or "junction" in front of the path.

Is it even possible technically to find out from a path if it's inside a symlink or junction?
In my example, e:\dir1\folder1\and\a\lot\deeper\file.txt is still physically on f:\ drive, but can TC even know that?

Could it be done with the "NTLinks" plugin?
Thanks for any ideas!
jj42
Junior Member
Junior Member
Posts: 50
Joined: 2007-08-18, 23:17 UTC

Re: Show when inside a junction/symlink folder

Post by *jj42 »

jj42 wrote: 2022-04-24, 15:11 UTC Could it be done with the "NTLinks" plugin?
With the NTLinks plugin, I've added some custom columns to show the type of link and also the target.
And in an older thread I found that it's possible to put the info from the plugin into an tooltip.

[=ntlinks.Real path] does show the real path of files and subfolders inside a symlink or junction!
Now... is it possible to compare the real path to the current path? If it can be detected that these are not the same, one could probably make the linked files/folders look different.
jj42
Junior Member
Junior Member
Posts: 50
Joined: 2007-08-18, 23:17 UTC

Re: Show when inside a junction/symlink folder

Post by *jj42 »

I tried to do "Define Colors by File Type" using a selection like
Plugin: ntlinks, Property: Real path, OP: !=, Value: [=tc.path]
but this seems not to work (not surprisingly)

Does anybody have an idea that might work?
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: Show when inside a junction/symlink folder

Post by *tuska »

jj42 wrote: 2022-04-24, 15:11 UTC ... junction e:\dir1\folder1 ...
... in "e:\dir1" you will see the arrow overlay on the folder symbol.
Try this.
Configuration -> Options -> View Mode
  • Click on <Vorgabe> or <Default>
  • Columns view: Full
  • Sort Order: Name
    ---------------
  • Click on Add... -> Background_GREEN -> OK
  • Background: Click on >> Change to these values, then click on "OK":

    Code: Select all

    80	0
    240 	55
    26	0
  • Background2: Click on >> Change to these values, then click on "OK":
    Change to the values of "Background" = same values
  • Leave all other values unchanged
     
  • Configuration -> Auto Switch Mode
    [x] Automatically switch View Mode on directory change
  • Add... -> Rule: +: Must match -> Directory: e:\dir1\*
  • Set this mode: Background_GREEN (=Name of your View Mode)
  • Click on "Apply", then on "OK"
  • Change into the directory e:\dir1 -> Auto Switch Mode is applied -> Background_GREEN
  • If you switch from e:\dir1 to e:\ and the Auto Switch Mode is NOT automatically terminated, then press this button:

    Code: Select all

    TOTALCMD#BAR#DATA
    cm_SrcViewMode0,cm_SrcAllFiles,cm_50Percent,cm_RereadSource,cm_rereadsource 1
    
    wcmicons.dll,86
    cm_SrcViewMode0,cm_SrcAllFiles,cm_50Percent,cm_RereadSource,cm_rereadsource 1|View mode <Standard>: cm_SrcViewMode0|Active panel!|-|cm_RereadSource Ctrl+R|-|cm_rereadsource 1 )|cm_rereadsource 2 )|cm_rereadsource 3 ) <as of TC 9.50 --> see: HISTORY.TXT!>
    
    0
    -1
  • Then change again into the directory e:\dir1 and back to e:\. The Auto Switch Mode should end automatically.
  • Overview: View Mode | Auto Switch Mode | Custom columns view
jj42
Junior Member
Junior Member
Posts: 50
Joined: 2007-08-18, 23:17 UTC

Re: Show when inside a junction/symlink folder

Post by *jj42 »

Hi tuska, thank you!
But this will only work for the exact folder(s) matched in the Rule, am I right?
I'd want it to automatically detect when a folder or file is "inside" a junction or symlink. Maybe this is not possible (yet) with what TC can do.
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: Show when inside a junction/symlink folder

Post by *tuska »

jj42 wrote: 2022-04-25, 11:17 UTC Hi tuska, thank you!
But this will only work for the exact folder(s) matched in the Rule, am I right?
I'd want it to automatically detect when a folder or file is "inside" a junction or symlink. Maybe this is not possible (yet) with what TC can do.
I think I can only answer your two questions with "yes". :(

A search query in TC - using the tool 'Everything' - is possible as follows:
Search for:

Code: Select all

ev:attrib:L
[✓] 'Everything'
Save this search as: Reparse-Target_Symbolic-link_Junction_for_Files-and-Folders

and can be specified, for example, in the View Mode "Background_GREEN" in the "Auto-run commands:" field as follows:

Code: Select all

LOADSEARCH Reparse-Target_Symbolic-link_Junction_for_Files-and-Folders
but in the Auto Switch Mode it must then be specified to which option (search result, path, drive, etc.)
the search result (Junctions) "commissioned" in View Mode is to be applied.

So I don't know of any solution. Sorry.
BUTTON ev:attrib:L - Reparse-Target_Symbolic-link_Junction_for_Files-and-Folders

Code: Select all

TOTALCMD#BAR#DATA
LOADSEARCH
==Reparse-Target_Symbolic-link_Junction_for_Files-and-Folders
wciconex.dll,27
LOADSEARCH==Reparse-Target_Symbolic-link_Junction_for_Files-and-Folders|ev:attrib:L|possible to search symbolic links with everything?|https://www.voidtools.com/forum/viewtopic.php?f=5&t=11394|https://www.ghisler.ch/board/viewtopic.php?t=76423


-1


Windows 10 Pro (x64) Version 21H2 (OS build 19044.1645) | TC 10.50b2 x64/x86
'Everything' 1.5.0.1310a (x64) | Troubleshooting | Search queries: TC <=> 'Everything'
jj42
Junior Member
Junior Member
Posts: 50
Joined: 2007-08-18, 23:17 UTC

Re: Show when inside a junction/symlink folder

Post by *jj42 »

Thank you tuska, no need to be sorry :D
I've learned more about TC, everything and junctions / symlinks here, which is always good. I didn't know that theres a "l" attribute for links, for example... and I found also that tc can use "tc.file type = reparse point" also.
But getting at the things inside such a folder seems not yet possible, since they don't have a "l" attribute themselves.

Maybe @ghisler can add something to help with that in a future version of TC.
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: Show when inside a junction/symlink folder

Post by *tuska »

Layman's view:

Maybe it would help to add to the existing Auto Switch Mode sub-rules, such as +: Must match, etc.
another options, such as J for Junctions and Y for Symlinks.

If you change to a folder in which junctions are present (recognisable, for example, by the folder symbol),
then the View Mode should be executed with Auto Switch Mode.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Show when inside a junction/symlink folder

Post by *petermad »

Maybe it would help to add to the existing Auto Switch Mode sub-rules, such as +: Must match, etc.
another options, such as J for Junctions and Y for Symlinks.
That could be a good addition to TC - Support ++
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
jj42
Junior Member
Junior Member
Posts: 50
Joined: 2007-08-18, 23:17 UTC

Re: Show when inside a junction/symlink folder

Post by *jj42 »

petermad wrote: 2022-04-26, 22:05 UTC
Maybe it would help to add to the existing Auto Switch Mode sub-rules, such as +: Must match, etc.
another options, such as J for Junctions and Y for Symlinks.
That could be a good addition to TC - Support ++
Yeah, that would be very helpful :)

Another idea that could be very powerful:
When defining searches, make it possible to use something like [=tc.path] (or any plugin field) as a value. This way you could compare two fields with "==" or "!=".
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Show when inside a junction/symlink folder

Post by *petermad »

When defining searches, make it possible to use something like [=tc.path] (or any plugin field) as a value.
Also a good idea - support++

It is already possible in the Change attributes dialog to feed output from one plugin to another. So something along the same path for Find Files.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Show when inside a junction/symlink folder

Post by *Fla$her »

2jj42
You can use WinScript Advanced:
1. options.ini:
[Script]
ActiveScripts=...|NTLink

[NTLink]
Script=IsNTLink.vbs
content=IsNTLink
FoldersPaths=1
extensions=*
2. Scripts\IsNTLink.vbs:

Code: Select all

Set I = CreateObject("Shell.Application").NameSpace(0).ParseName(FileName)
If I.IsLink Then
   If StrComp(Right(FileName, 4), ".lnk", 1) - I.IsFolder Then Content = "Yes"
Else
   Do: Set I = I.Parent.Self
       If I.IsLink Then Content = "Yes": Exit Do
   Loop Until Len(I.Path) = 3
End If
Set I = Nothing
3. Execute cm_UnloadPlugins
4. For columns or hints (with colors, it's better not to do), set: [=winscriptsadv.IsNTLink] or [="Is NTLink: "winscriptsadv.IsNTLink]
Last edited by white on 2022-05-20, 21:23 UTC, edited 1 time in total.
Reason: ".Parent.Self" deleted in the code (requested by author)
Overquoting is evil! 👎
Post Reply