Feature Request: show hardlinked files of selected files
Moderators: white, Hacker, petermad, Stefan2
Feature Request: show hardlinked files of selected files
idea:
select some files and press a key combination. As a result in the active panel or (better) in the 2nd panel all the files are listed which are hard linked to the selected files.
maybe this also useful for directories and symbolic links.
select some files and press a key combination. As a result in the active panel or (better) in the 2nd panel all the files are listed which are hard linked to the selected files.
maybe this also useful for directories and symbolic links.
Re: Feature Request: show hardlinked files of selected files
2Anselm
Try this:
.vbs + ln + TCFS2
Try this:
.vbs + ln + TCFS2
Code: Select all
'——————————————————————————— VBS ———————————————————————————
' Purpose: Display list of hard links to the selected files
' Condition: Create em_LOADLIST with LOADLIST/%A (1/2 field)
' Parameters: %WL [/t] [/n]
' /t — show in target panel
' /n — show in new tab
Option Explicit
'————————————— Paths to ln and TCFS2 utilities —————————————
Const LN = """%COMMANDER_PATH%\Utils\ln\ln.exe"""
Const TCFS2 = """%COMMANDER_PATH%\Utils\TCFS2\TCFS2.exe"""
'——————————————————————————————————————— Author: Flasher © —
Dim A, FSO, WSS, List, L, F, Text, T, E
Set A = WSH.Arguments : If A.Count = 0 Then WSH.Quit
Set FSO = CreateObject("Scripting.FileSystemObject")
L = FSO.GetSpecialFolder(2) & "\" & FSO.GetTempName
Set WSS = CreateObject("WScript.Shell")
Set List = FSO.OpenTextFile(A(0),,,-1)
Do: F = List.ReadLine
If Right(F, 1) <> "\" Then _
WSS.Run "%ComSpec% /q/c """ & LN & " --list """ & F & """>>""" & L & """""", 0, 1
Loop Until List.AtEndOfStream : List.Close : Set List = Nothing
If FSO.FileExists(L) Then
Text = FSO.OpenTextFile(L).ReadAll
With New RegExp
.Pattern = "^l..[.0-9]+\r\n|\r\nl..[.0-9]+"
.Global = 1: Text = .Replace(Text, "")
End With
If A.Named.Exists("t") Then T = "tcm(4006) "
If A.Named.Exists("n") Then T = "msg($0B,0) " & T & "tcm(3001) " : E = " msg($0B,1) redraw()"
With FSO.OpenTextFile(L, 2) .Write Text : .Close : End With
WSS.Run TCFS2 & " /ef """ & T & "tem(`em_LOADLIST " & L & "`)" & E & """",, 1
FSO.DeleteFile L, 1
End If
Set FSO = Nothing : Set WSS = Nothing
Last edited by Fla$her on 2022-05-23, 20:07 UTC, edited 3 times in total.
Overquoting is evil! 👎
Re: Feature Request: show hardlinked files of selected files
thanks @Fla$her
i have to put ln and TCFS2 to the folder used in the script.
1. How do i integrate the vbs script to TC?
2. How can i configure:
' Condition: Create em_LOADLIST with LOADLIST/%A (1/2 field)
' Parameter: %WL
i have to put ln and TCFS2 to the folder used in the script.
1. How do i integrate the vbs script to TC?
2. How can i configure:
' Condition: Create em_LOADLIST with LOADLIST/%A (1/2 field)
' Parameter: %WL
Re: Feature Request: show hardlinked files of selected files
2Anselm
Don't you see " Paths to ln and TCFS2 utilities " in the script header? Set your paths.
1-2. You should know how to make em_ commands and hotkeys for them. See the help.
Example:
em_ListHDlinksToSelFiles (+ hotkey in the Misc. settings page):
Command: %COMMANDER_PATH%\Scripts\ListHDlinksToSelFiles.vbs
Parameters: %WL
em_LOADLIST:
Command: LOADLIST
Parameters: %A
Don't you see " Paths to ln and TCFS2 utilities " in the script header? Set your paths.
1-2. You should know how to make em_ commands and hotkeys for them. See the help.
Example:
em_ListHDlinksToSelFiles (+ hotkey in the Misc. settings page):
Command: %COMMANDER_PATH%\Scripts\ListHDlinksToSelFiles.vbs
Parameters: %WL
em_LOADLIST:
Command: LOADLIST
Parameters: %A
Overquoting is evil! 👎
Re: Feature Request: show hardlinked files of selected files
Thank you, i still have trouble.
Using the hotkey i am getting an error:
My configuration:
no changes in ListHDlinksToSelFiles.vbs script.
location of ListHDlinksToSelFiles.vbs, ln, TCFS2:
1.
Configuration --> Options... --> Misc.:
Using the hotkey i am getting an error:
Code: Select all
< Error! >
File not found!
C:\Users\Username\AppData\Local\Temp\rad67C8B.tmp
no changes in ListHDlinksToSelFiles.vbs script.
location of ListHDlinksToSelFiles.vbs, ln, TCFS2:
Code: Select all
C:\TOTALCMD
| ...
|
+---Scripts
| ListHDlinksToSelFiles.vbs
|
\---Utils
|
+---ln
| | ln.exe
| | ...
|
+---TCFS2
| Readme.txt
| TCFS2.Core.ini
| TCFS2.exe
| TCFS2.ini
Configuration --> Options... --> Misc.:
- hotkey: Alt+F7
Click the button with the magnifying glass
choose category: usercmd.ini --> New...
new command name (em.xyz): em_ListHDlinksToSelFiles
Change user command: em_ListHDlinksToSelFiles- command: %COMMANDER_PATH%\Scripts\ListHDlinksToSelFiles.vbs
Parameters: %WL
press button: OK
press button with the green checkmark - command: %COMMANDER_PATH%\Scripts\ListHDlinksToSelFiles.vbs
- Alias: em_LOADLIST
Click the button with the magnifying glass
new command name (em.xyz): em_LOADLIST- command: LOADLIST
Parameters: %A
press button: OK
press button with the green checkmark - command: LOADLIST
Re: Feature Request: show hardlinked files of selected files
2Anselm
Does TC or script show this error? Was there a line number shown there?
What bit depth do ln.exe and your Windows have?
You may have selected a large array of files.
Add ,, 1 to the end of line 28.
Does TC or script show this error? Was there a line number shown there?
What bit depth do ln.exe and your Windows have?
You may have selected a large array of files.
Add ,, 1 to the end of line 28.
Overquoting is evil! 👎
Re: Feature Request: show hardlinked files of selected files
2Fla$her
i think the filename rad67C8B.tmp is wrong, the existing one is:
CMDEE84.tmp
Do you have an idea what is wrong?
i think the filename rad67C8B.tmp is wrong, the existing one is:
CMDEE84.tmp
Do you have an idea what is wrong?
Re: Feature Request: show hardlinked files of selected files
C:\totalcmd\Utils\ln\ln.exe
TC shows the error
I only selected one file:
The content of the tmp file is:
c:\test\test
Code: Select all
C:\WINDOWS\system32>fsutil.exe hardlink list "c:\test\test
\test\a\test2
\test\test
Re: Feature Request: show hardlinked files of selected files
2Anselm
You're not answering my questions.
You're not answering my questions.
Did you make the addition in the code?
Why kill the search dialog call?
Overquoting is evil! 👎
Re: Feature Request: show hardlinked files of selected files
I copied the error text word by word. There is no line number shown.
What do you mean with bit depth? I though you mean folder depth.
Did you make the addition in the code?
Sorry i did not see this.
yes, it works with this change. Thank you, very nice.
Anything i can do to show the result in the "non active" panel?
Why kill the search dialog call?
which search dialog? It makes it so complicated, because i am not able to upload screen shots.
Re: Feature Request: show hardlinked files of selected files
Good. You’re welcome. )
Added two keys to the parameters.
Alt+F7 brings up "Find Files" dialog by default. You didn't know about this? Execute cm_Keyboard from TC command line.
Overquoting is evil! 👎
Re: Feature Request: show hardlinked files of selected files
2Fla$her
I was not aware ALT+F7 is associated with "find files". Thank you for the hint and the hint to key mapping help.
Does the TOTALCMD.CHM also exist in English? I would like to know the English terms to get a better understanding of the naming of the cm_ commands.
F11 and F12 are not occupied, but does not work.
I will switch to ALT+digit, hopefully they are not occupied.
So i changed your code to:
content of usercmd.ini is:
thank you very much Fla$her
Yes and no. I was aware TC does not warn me if i am overriding existing TC default keys.
I was not aware ALT+F7 is associated with "find files". Thank you for the hint and the hint to key mapping help.
Does the TOTALCMD.CHM also exist in English? I would like to know the English terms to get a better understanding of the naming of the cm_ commands.
F11 and F12 are not occupied, but does not work.
I will switch to ALT+digit, hopefully they are not occupied.
I am inexperienced with vbs and parameter evaluation in vbs. So I hard coded it to your vbs, adding to line 28:
Code: Select all
WSS.Run TCFS2 & " /ef ""tem(cm_FocusTrg)""",, 1
Code: Select all
'——————————————————————————— VBS ———————————————————————————
' Purpose: Display list of hard links to the selected files
' Condition: Create em_LOADLIST with LOADLIST/%A (1/2 field)
' Parameter: %WL
Option Explicit
'————————————— Paths to ln and TCFS2 utilities —————————————
Const LN = """%COMMANDER_PATH%\Utils\ln\ln.exe"""
Const TCFS2 = """%COMMANDER_PATH%\Utils\TCFS2\TCFS2.exe"""
'——————————————————————————————————————— Author: Flasher © —
Dim FSO, WSS, List, L, F, Text
If WSH.Arguments.Count = 0 Then WSH.Quit
Set FSO = CreateObject("Scripting.FileSystemObject")
L = FSO.GetSpecialFolder(2) & "\" & FSO.GetTempName
Set WSS = CreateObject("WScript.Shell")
Set List = FSO.OpenTextFile(WSH.Arguments(0),,,-1)
Do: F = List.ReadLine
If Right(F, 1) <> "\" Then _
WSS.Run "%ComSpec% /q/c """ & LN & " --list """ & F & """>>""" & L & """""", 0, 1
Loop Until List.AtEndOfStream : List.Close : Set List = Nothing
If FSO.FileExists(L) Then
Text = FSO.OpenTextFile(L).ReadAll
With New RegExp
.Pattern = "^l..[.0-9]+\r\n|\r\nl..[.0-9]+"
.Global = 1: Text = .Replace(Text, "")
End With
With FSO.OpenTextFile(L, 2) .Write Text : .Close : End With
WSS.Run TCFS2 & " /ef ""tem(cm_FocusTrg)""",, 1
WSS.Run TCFS2 & " /ef ""tem(`em_LOADLIST " & L & "`)""",, 1
FSO.DeleteFile L, 1
End If
Set FSO = Nothing : Set WSS = Nothing
Code: Select all
[em_ListHDlinksToSelFiles]
button=
cmd=%COMMANDER_PATH%\Scripts\ListHDlinksToSelFiles.vbs
param=%WL
[em_LOADLIST]
button=
cmd=LOADLIST
param=%A
Last edited by white on 2022-05-24, 13:59 UTC, edited 1 time in total.
Reason: added: 2Fla$her
Reason: added: 2Fla$her
Re: Feature Request: show hardlinked files of selected files
Moderator message from: white » 2022-05-24, 13:59 UTC
Removed duplicate post.
Added 2Fla$her to previous post (because author was probably trying to do that).
Added 2Fla$her to previous post (because author was probably trying to do that).
Re: Feature Request: show hardlinked files of selected files
What language do you speak yourself? English and German help are included in the TC distribution kit by default.
It's voluntary, of course, but I would choose a letter (L or H) instead of a digit.
This has the same relation to vbs as to any other parameterized program. Is it really so difficult to specify %WL /t or %WL /t /n in the parameters?
Actually, tem is needed for em_ commands. Although it has been working with internal commands for some time (this was done to support parameters), but it would be more correct to use tcm(№), which is done in my code. And, of course, it makes no sense to split the commands into 2 separate launches of the utility. Use my script, where optimization is provided.
Overquoting is evil! 👎