Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
Moderators: petermad, Stefan2, white, Hacker
Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
For example, the path "\\\Secure FTP\User1\home\wwwroot\my001\"
remove \\\Secure FTP\User1, leaving only \home\wwwroot\my001\
How to do this using bat or script.
For example, the path "\\\Secure FTP\User1\home\wwwroot\my001\"
remove \\\Secure FTP\User1, leaving only \home\wwwroot\my001\
How to do this using bat or script.
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
PowerShell script .ps1
A usage example:
Image: https://i.imgur.com/G6JFrYZ.mp4
Note. I used "-replace '\\+','\'" for the example since I don't have "\\\Secure FTP\User1\..." paths in hand.
Edit.
To make a TotalComander button with the script:
User-command (usercmd.ini)
User-button:
A usage example with the TC button (this time I used ".Replace('\\Network\','')" for it):
Image: https://i.imgur.com/sbdkIXg.mp4
Code: Select all
$paths = Get-Clipboard
$update = @()
foreach ($path in $paths) {
$update += $path.replace('\\\Secure FTP\User1','')
}
$update | Set-Clipboard
Image: https://i.imgur.com/G6JFrYZ.mp4
Note. I used "-replace '\\+','\'" for the example since I don't have "\\\Secure FTP\User1\..." paths in hand.
Edit.
To make a TotalComander button with the script:
User-command (usercmd.ini)
Code: Select all
[em_changeClipPaths]
cmd=pwsh -c "c:\Test\CopyFullNamesToClipChangePaths.ps1"
Code: Select all
TOTALCMD#BAR#DATA
em_changeClipPaths
WCMICON2.DLL
0
-1
Image: https://i.imgur.com/sbdkIXg.mp4
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2beb
This code does not achieve the desired effect. I want to copy the path of the selected object directly and automatically remove the unnecessary prefix path \\\Secure FTP\User1
Image: http://cdnjson.com/images/2025/02/04/Video_2025-02-04_031812.gif
This code does not achieve the desired effect. I want to copy the path of the selected object directly and automatically remove the unnecessary prefix path \\\Secure FTP\User1
Image: http://cdnjson.com/images/2025/02/04/Video_2025-02-04_031812.gif
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2xxxdo1
The PowerShell script does exactly and namely what you have requested it to do.
1. The cm_CopyFullNamesToClip command copies the fullname(s) of the file/folder under the cursor/selected files/folders into the clipboard.
2. The PowerShell script in its turn:
2.1. At first--automatically catches the clipboard contents and automatically changes the paths "\\\Secure FTP\User1" prefix to nothing.
2.2. Then--automatically replaces the initial clipboard contents with the modified one, now with the paths that do not include the "\\\Secure FTP\User1" prefix anymore.
3. Eventually, you get the clipboard contents with the automatically removed "\\\Secure FTP\User1" prefix, as requested.
That's it. Just take it (the clipboard contents with the modified path(s)) and do whatever you need to do with it.
I have modified Total Commander's user button to do the job in one click (via the cm_CopyFullNamesToClip,em_changeClipPaths chain command) as follows:
The script itself remains the same (see the code in my previous message above).
Here's how it works (now it's the real-life example, for which I installed the SFTP plugin and found a server for testing):
Image: https://i.imgur.com/Hmiyjrd.mp4
The PowerShell script does exactly and namely what you have requested it to do.
1. The cm_CopyFullNamesToClip command copies the fullname(s) of the file/folder under the cursor/selected files/folders into the clipboard.
2. The PowerShell script in its turn:
2.1. At first--automatically catches the clipboard contents and automatically changes the paths "\\\Secure FTP\User1" prefix to nothing.
2.2. Then--automatically replaces the initial clipboard contents with the modified one, now with the paths that do not include the "\\\Secure FTP\User1" prefix anymore.
3. Eventually, you get the clipboard contents with the automatically removed "\\\Secure FTP\User1" prefix, as requested.
That's it. Just take it (the clipboard contents with the modified path(s)) and do whatever you need to do with it.
I have modified Total Commander's user button to do the job in one click (via the cm_CopyFullNamesToClip,em_changeClipPaths chain command) as follows:
Code: Select all
TOTALCMD#BAR#DATA
cm_CopyFullNamesToClip,em_changeClipPaths
WCMICON2.DLL
-1
Here's how it works (now it's the real-life example, for which I installed the SFTP plugin and found a server for testing):
Image: https://i.imgur.com/Hmiyjrd.mp4
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2xxxdo1
Register the command in %COMMANDER_PATH%\Plugins\wdx\Autorun\autorun.cfg:
And use 60000 as an internal command. The description for cm_CommandBrowser can be added to Totalcmd.inc and Language\Wcmd_lng.inc.
If desired, it's possible to make a more universal version with a numerical parameter of the cut-off parts.
Register the command in %COMMANDER_PATH%\Plugins\wdx\Autorun\autorun.cfg:
Code: Select all
LoadLibrary Plugins\Autorun_Runtime.dll
RegisterCommand 60000 CopyFullNamesWithoutFirst2PartsOfWFXPath
Func CopyFullNamesWithoutFirst2PartsOfWFXPath(lParam)
SendMessage(AUTORUN_TCHANDLE, 1075, 2018)
ClipGet List
If StrLeft(List, 3) = '\\\' Then ClipPut(StrReplace(List, '\\\' & _
StrPart(RequestCopyDataInfo('SP'), '\', 4) & '\' & StrPart(RequestCopyDataInfo('SP'), '\', 5), ''))
EndFunc
If desired, it's possible to make a more universal version with a numerical parameter of the cut-off parts.
Overquoting is evil! 👎
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2beb
It works, but using ps1 is too slow.
Is there any other more efficient method?
2Fla$her
I added this code to autorun.cfg and restarted TC, Use cmd=60000, popup message: Cannot find 60000
Image: http://cdnjson.com/images/2025/02/04/202524185251228.png
It works, but using ps1 is too slow.
Is there any other more efficient method?
2Fla$her
I added this code to autorun.cfg and restarted TC, Use cmd=60000, popup message: Cannot find 60000
Image: http://cdnjson.com/images/2025/02/04/202524185251228.png
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2xxxdo1
Is this the first use of the plugin? If so, see all stages of installation.
Is this the first use of the plugin? If so, see all stages of installation.
Overquoting is evil! 👎
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2Fla$her
Thanks, it works, solved. Using the plug-in method is more efficient.
TC button, how to add an if condition.
For example, if it is a local path, use cm_CopyFullNamesToClip, if it is a network path, use command 60000
Thanks, it works, solved. Using the plug-in method is more efficient.
TC button, how to add an if condition.
For example, if it is a local path, use cm_CopyFullNamesToClip, if it is a network path, use command 60000
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
This is not necessary in this case. It's enough to use only 60000 for both types of paths. It's more handy for one hotkey/button.xxxdo1 wrote: 2025-02-04, 17:20 UTC if it is a local path, use cm_CopyFullNamesToClip, if it is a network path, use command 60000
You're welcome.

Overquoting is evil! 👎
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2Fla$her
I use the autorun plugin to register command 60000. Every time I want to use it, I need to manually open cm_SrcUserDef and choose to load the template, otherwise TC cannot find command 60000.
How can I set it to load automatically when TC starts?
I use the autorun plugin to register command 60000. Every time I want to use it, I need to manually open cm_SrcUserDef and choose to load the template, otherwise TC cannot find command 60000.
How can I set it to load automatically when TC starts?
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
I didn't understand the meaning of this phrase. What could be the connection between the filtering window and copying paths to the clipboard?xxxdo1 wrote: 2025-02-05, 13:15 UTC Every time I want to use it, I need to manually open cm_SrcUserDef and choose to load the template, otherwise TC cannot find command 60000.
Overquoting is evil! 👎
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
Demo example:Fla$her wrote: 2025-02-05, 19:58 UTC I didn't understand the meaning of this phrase. What could be the connection between the filtering window and copying paths to the clipboard?
Image: https://s3.cdnjson.com/images/2025/02/07/Video_2025-02-07_172358.gif
The autorun plugin cannot be automatically loaded when TC starts. I need to open cm_SrcUserDef to load the autorun plugin manually, otherwise the command 80001 cannot be found.
Last edited by xxxdo1 on 2025-02-07, 09:28 UTC, edited 1 time in total.
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2xxxdo1
Still, for completeness of understanding you could at least temporarily - but switch the interface to English?
It's not that hard - and it would make more sense to us.....
This of course doesn't answer your main current question (sorry for that) - but still defines a pleasant communication style...
Still, for completeness of understanding you could at least temporarily - but switch the interface to English?
It's not that hard - and it would make more sense to us.....
This of course doesn't answer your main current question (sorry for that) - but still defines a pleasant communication style...
#146217 personal license
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2xxxdo1
Now I understand: you didn't cope with the installation. Make sure you have lines like these in wincmd.ini:
Now I understand: you didn't cope with the installation. Make sure you have lines like these in wincmd.ini:
Code: Select all
[ContentPlugins]
0=%COMMANDER_PATH%\Plugins\wdx\Autorun\autorun.wdx
[Searches]
...
Autorun_SearchFlags=0|002002000020|||||||||0000|
Autorun_plugin=autorun.Autorun > 0
Overquoting is evil! 👎
Re: Using cm_CopyFullNamesToClip, can I remove the prefix path when copying a network path?
2AntonyD
Sorry, I re-uploaded the English demo.
Image: https://s3.cdnjson.com/images/2025/02/07/Video_2025-02-07_172358.gif
2Fla$her
I should have completed the installation. My configuration is the same as yours.
But the autorun plugin cannot be automatically loaded when TC starts
Sorry, I re-uploaded the English demo.
Image: https://s3.cdnjson.com/images/2025/02/07/Video_2025-02-07_172358.gif
2Fla$her
I should have completed the installation. My configuration is the same as yours.
But the autorun plugin cannot be automatically loaded when TC starts
Code: Select all
[ContentPlugins]
0=%COMMANDER_PATH%\Plugins\Wdx\Autorun\Autorun.wdx
0_detect=
0_date=1501801560
0_flags=0
[Searches]
AutoRun_ChangeClipPaths_SearchFor=
AutoRun_ChangeClipPaths_SearchIn=
AutoRun_ChangeClipPaths_SearchText=
AutoRun_ChangeClipPaths_SearchFlags=0|002002000020|||||||||0000|||
AutoRun_ChangeClipPaths_plugin=autorun.Autorun = 1