New command: cm_CopyRelativeNamesToClip - Copy relative file names
Moderators: white, Hacker, petermad, Stefan2
New command: cm_CopyRelativeNamesToClip - Copy relative file names
At the moment we have:
cm_CopyFullNamesToClip
ex:
c:\users\username\desktop\a.txt
c:\users\username\desktop\b.txt
c:\users\username\desktop\subdir\c.txt
cm_CopyNamesToClip
ex:
a.txt
b.txt
c.txt
My suggestion is a cm_CopyRelativeNamesToClip
ex:
a.txt
b.txt
subdir\c.txt
The base path would be the selected panel's path.
When is this useful?
When we want to capture a list of all files in a directory and subdirectory, but we don't want to disclose the full path or it is not relevant.
Currently, what I do is to ctrl+b to have all files listed in the panel.
Then I ctrl+a to select them all.
I use cm_CopyFullNamesToClip but then I have to do some cleanup.
Then I have to ctrl+v that into notepad++ and replace the c:\... to clear the absolute part of the path. And ctrl+a and ctrl+c again.
If I had the cm_CopyRelativeNamesToClip, a simple ctrl+b, ctrl+a, cm_CopyRelativeNamesToClip would get the job done.
Subject adjusted by moderator to make it more clear.
cm_CopyFullNamesToClip
ex:
c:\users\username\desktop\a.txt
c:\users\username\desktop\b.txt
c:\users\username\desktop\subdir\c.txt
cm_CopyNamesToClip
ex:
a.txt
b.txt
c.txt
My suggestion is a cm_CopyRelativeNamesToClip
ex:
a.txt
b.txt
subdir\c.txt
The base path would be the selected panel's path.
When is this useful?
When we want to capture a list of all files in a directory and subdirectory, but we don't want to disclose the full path or it is not relevant.
Currently, what I do is to ctrl+b to have all files listed in the panel.
Then I ctrl+a to select them all.
I use cm_CopyFullNamesToClip but then I have to do some cleanup.
Then I have to ctrl+v that into notepad++ and replace the c:\... to clear the absolute part of the path. And ctrl+a and ctrl+c again.
If I had the cm_CopyRelativeNamesToClip, a simple ctrl+b, ctrl+a, cm_CopyRelativeNamesToClip would get the job done.
Subject adjusted by moderator to make it more clear.
Re: Copy relative file names
- download and install: https://totalcmd.net/plugring/list2clip.html
- create a usercommand (usercmd.ini):
- use em_CopyRelativeNamesToClip for a button (copy code into clipboard; paste into buttonbar):
- or assign a shortcut to the usercommand (wincmd.ini):
HTH
Holger
- create a usercommand (usercmd.ini):
Code: Select all
[em_CopyRelativeNamesToClip]
button=%COMMANDER_PATH%\Addons\Lst2Clip\Lst2Clip.exe
cmd=%COMMANDER_PATH%\Addons\Lst2Clip\Lst2Clip.exe
param=/R:"%P"="" /L:"%L"
path=%COMMANDER_PATH%\Addons\Lst2Clip\
menu=Lst2Clip (relative path)
Code: Select all
TOTALCMD#BAR#DATA
em_CopyRelativeNamesToClip
%COMMANDER_PATH%\Addons\Lst2Clip\Lst2Clip.exe
Lst2Clip (relative path)
0
10015
Code: Select all
[Shortcuts]
CS+R=em_CopyRelativeNamesToClip
Holger
Make our planet great again
Re: Copy relative file names
In stead of using cm_CopyFullNamesToClip you can use this em_commandCurrently, what I do is to ctrl+b to have all files listed in the panel.
Then I ctrl+a to select them all.
I use cm_CopyFullNamesToClip but then I have to do some cleanup.
Code: Select all
[em_saveselection]
cmd=SAVESELECTION
param="%PSELECTEDFILES.txt"
menu=Save file names in the file SELECTEDFILES.txt
You can combine it all in one em_command
Code: Select all
[em_branchview_saveselection]
cmd=cm_DirBranch 1,cm_SelectAllFiles,em_saveselection,cm_DirBranch 2
menu=Open Branch view, save file names in the file SELECTEDFILES.txt, close branch view
if you make an extra em_command:
Code: Select all
[em_goto_selectedfilestxt]
cmd=cd SELECTEDFILES.txt
Code: Select all
[em_branchview_saveselection]
cmd=cm_DirBranch 1,cm_SelectAllFiles,em_saveselection,cm_DirBranch 2,em_goto_selectedfilestxt
Code: Select all
[em_branchview_saveselection]
cmd=cm_DirBranch 1,cm_SelectAllFiles,em_saveselection,cm_DirBranch 2,em_goto_selectedfilestxt,cm_Wait 100,cm_RenameSingleFile
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Copy relative file names
Alternative solution using Powershell:
Regards
Holger
Code: Select all
[em_CopyRelativeNamesToClip]
button=WCMICONS.DLL,45
cmd=powershell.exe
param=(Get-Content '%L').Replace( '%P', '')|Set-Clipboard
menu=relative paths to clipboard
iconic=1
Holger
Make our planet great again
Re: Copy relative file names
2HolgerK, I'll try your first suggestion as it seems it does exactly what I am talking about. Thank you and 2petermad for all the other suggestions as well.
However, I still think that this should be part of standard TC commands. It just feels like it's missing. We have bare file names and absolute file path+names, but we don't have relative file path+names. To achieve this, we need to add a plugin. It just feels like it's missing and it wouldn't be that hard to do considering we have the absolute path+names already implemented and we have the panel's directory to know what should be removed from (or not added to) the path (depending on how it was implemented).
Don't you feel that since we already have these 2 ways to copy file lists, the 3rd one I'm suggesting is a logical complement?
However, I still think that this should be part of standard TC commands. It just feels like it's missing. We have bare file names and absolute file path+names, but we don't have relative file path+names. To achieve this, we need to add a plugin. It just feels like it's missing and it wouldn't be that hard to do considering we have the absolute path+names already implemented and we have the panel's directory to know what should be removed from (or not added to) the path (depending on how it was implemented).
Don't you feel that since we already have these 2 ways to copy file lists, the 3rd one I'm suggesting is a logical complement?
Re: Copy relative file names
2pplupo
Just to make it clear: My suggestion does not need a plugin - it uses functions already build into TC.To achieve this, we need to add a plugin
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Copy relative file names
Nothing against a build in command (my solution won't work with search results), ... but adding some lines to usercmd.ini is not a big deal
And PowerShell is part of Windows since W7 (no additional installation required).
cm_CopyNamesToClip=2017;Copy filenames to clipboard
cm_CopyFullNamesToClip=2018;Copy names with full path
cm_CopyNetNamesToClip=2021;Copy names with UNC path
cm_CopyFileDetailsToClip=2036;Copy all shown columns
cm_CopyFpFileDetailsToClip=2037;Copy all columns, with full path
cm_CopyNetFileDetailsToClip=2038;Copy all columns, with UNC path
cm_CopyHdrFpFileDetailsToClip=2091;Copy all columns, with headers+full path
cm_CopyHdrNetFileDetailsToClip=2092;Copy all columns, with headers+UNC path
at least three commands are needed:
cm_CopyRelativeNamesToClip ;Copy names with relative path
cm_CopyRelativeNamesDetailsToClip ;Copy all columns, with relative path
cm_CopyHdrRelativeFileDetailsToClip ;Copy all columns, with headers+relative path
Regards
Holger
and is available right now.
And PowerShell is part of Windows since W7 (no additional installation required).
we have more:We have bare file names and absolute file path+names, but we don't have relative file path+names.
cm_CopyNamesToClip=2017;Copy filenames to clipboard
cm_CopyFullNamesToClip=2018;Copy names with full path
cm_CopyNetNamesToClip=2021;Copy names with UNC path
cm_CopyFileDetailsToClip=2036;Copy all shown columns
cm_CopyFpFileDetailsToClip=2037;Copy all columns, with full path
cm_CopyNetFileDetailsToClip=2038;Copy all columns, with UNC path
cm_CopyHdrFpFileDetailsToClip=2091;Copy all columns, with headers+full path
cm_CopyHdrNetFileDetailsToClip=2092;Copy all columns, with headers+UNC path
at least three commands are needed:
cm_CopyRelativeNamesToClip ;Copy names with relative path
cm_CopyRelativeNamesDetailsToClip ;Copy all columns, with relative path
cm_CopyHdrRelativeFileDetailsToClip ;Copy all columns, with headers+relative path
Regards
Holger
Make our planet great again
Re: Copy relative file names
Your suggestion also doesn't do quite the same thing, right? It creates a file with what should end up in the clipboard.
Re: Copy relative file names
I agree that these 3 should be added. I think it's just natural, useful and it makes sense.HolgerK wrote: ↑2021-06-07, 21:47 UTC Nothing against a build in command (my solution won't work with search results), ... but adding some lines to usercmd.ini is not a big dealand is available right now.
And PowerShell is part of Windows since W7 (no additional installation required).
we have more:We have bare file names and absolute file path+names, but we don't have relative file path+names.
cm_CopyNamesToClip=2017;Copy filenames to clipboard
cm_CopyFullNamesToClip=2018;Copy names with full path
cm_CopyNetNamesToClip=2021;Copy names with UNC path
cm_CopyFileDetailsToClip=2036;Copy all shown columns
cm_CopyFpFileDetailsToClip=2037;Copy all columns, with full path
cm_CopyNetFileDetailsToClip=2038;Copy all columns, with UNC path
cm_CopyHdrFpFileDetailsToClip=2091;Copy all columns, with headers+full path
cm_CopyHdrNetFileDetailsToClip=2092;Copy all columns, with headers+UNC path
at least three commands are needed:
cm_CopyRelativeNamesToClip ;Copy names with relative path
cm_CopyRelativeNamesDetailsToClip ;Copy all columns, with relative path
cm_CopyHdrRelativeFileDetailsToClip ;Copy all columns, with headers+relative path
Regards
Holger
Re: Copy relative file names
Sure - I am not against your suggestion, just giving you a workaround in case the request is not honored.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar