Rename file on right panel the same as file on left panel + prefix/suffix
Moderators: Hacker, petermad, Stefan2, white
Rename file on right panel the same as file on left panel + prefix/suffix
Good afternoon,
I am currently trying to work out if it's possible to rename a file on the right panel the same as the file on the left panel plus a specific suffix/prefix? i.e. left file (source document) is called Test Document.docx and the right file (target document being returned to me) is called Test+Document-LP.docx
The documents should have the same name, but following the file being returned to me from someone else, it often has a slightly different naming convention. The fastest way I have worked out is the follow:
Select left file
ALT+C (redefined hotkey for rename single file)
CTRL +C (Copy)
Select right file
ALT+C (redefined hotkey for rename single file)
CTRL+V (Paste)
I tried creating a new command even for just renaming and copying, and a second for renaming and pasting by editing the usercmd.ini file with an em_Command, however this didn't seem to work.
If anybody has an idea on how to achieve this so by selecting a file in the source and a file in the target I could rename them the same with one click (and a suffix/prefix if possible) then I would be greatful!
I am currently trying to work out if it's possible to rename a file on the right panel the same as the file on the left panel plus a specific suffix/prefix? i.e. left file (source document) is called Test Document.docx and the right file (target document being returned to me) is called Test+Document-LP.docx
The documents should have the same name, but following the file being returned to me from someone else, it often has a slightly different naming convention. The fastest way I have worked out is the follow:
Select left file
ALT+C (redefined hotkey for rename single file)
CTRL +C (Copy)
Select right file
ALT+C (redefined hotkey for rename single file)
CTRL+V (Paste)
I tried creating a new command even for just renaming and copying, and a second for renaming and pasting by editing the usercmd.ini file with an em_Command, however this didn't seem to work.
If anybody has an idea on how to achieve this so by selecting a file in the source and a file in the target I could rename them the same with one click (and a suffix/prefix if possible) then I would be greatful!
Matthew
Re: Rename file on right panel the same as file on left panel + prefix/suffix
all,
Does anyone know if there is a %O but for the target file? Then we could do something like
Roman
Does anyone know if there is a %O but for the target file? Then we could do something like
Code: Select all
cmd /c ren %N "%???.%E"
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Rename file on right panel the same as file on left panel + prefix/suffix
You could use %M:~-0,255 to get the file name without extension of the file under the cursor in the target panel.Hacker wrote: 2023-05-14, 15:09 UTC all,
Does anyone know if there is a %O but for the target file? Then we could do something likeCode: Select all
cmd /c ren %N "%???.%E"
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Rename file on right panel the same as file on left panel + prefix/suffix
petermad,

mlc4886,
Seems to work. You can either add it to a button bar, or configure a hotkey, and create a new usercmd.ini em_ type command using the above details. You can also add any prefix or suffix if you like, e.g. "MyPrefix%M:~-0,255.%E" or "%M:~-0,255MySuffix.%E".
HTH
Roman
Thanks! Would be nice if that was documented in the Help fileuse %M:~-0,255

mlc4886,
Code: Select all
Command: cmd
Parameters: /k ren %N "%M:~-0,255.%E"
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Rename file on right panel the same as file on left panel + prefix/suffix
I somewhat is:Thanks! Would be nice if that was documented in the Help file
I just changed 20 to 255Help wrote:Note: All parameters now support substring fields in the form :~start,length, e.g. %N:~2,5 or %N:~-8,5 . To append a number directly after the length value, use another ~ character, e.g. %N:~2,5~2. Negative vaules are measured from the end of the string. Example: %P:~0,-1 cuts off the backslash from the path.
The Start value -0 is special: %N:~-0,20 copies the first 20 characters of the name without extension, %N:~-0,-20 the first 20 characters of the extension without the name.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Rename file on right panel the same as file on left panel + prefix/suffix
petermad,
Darn, must read more carefully. Thanks.
Roman
Darn, must read more carefully. Thanks.
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Rename file on right panel the same as file on left panel + prefix/suffix
This is great and exactly what I was trying to create, thanks!
I've given it a go on two computers and I keep getting a 'The system cannot find the file specified' error through the cmd prompt. I'll try and fix that then report back on my end.
Thanks!
I've given it a go on two computers and I keep getting a 'The system cannot find the file specified' error through the cmd prompt. I'll try and fix that then report back on my end.
Thanks!
Matthew
Re: Rename file on right panel the same as file on left panel + prefix/suffix
mlc4886,
Perhaps you didn't clear the Start path in the button you made.
Roman
Perhaps you didn't clear the Start path in the button you made.
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Rename file on right panel the same as file on left panel + prefix/suffix
2mlc4886
You could try replacing cmd with %COMSPEC%
You could try replacing cmd with %COMSPEC%
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Rename file on right panel the same as file on left panel + prefix/suffix
petermad,
Well, if that was the problem, he wouldn't get the cmd prompt.
Roman
Well, if that was the problem, he wouldn't get the cmd prompt.
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Rename file on right panel the same as file on left panel + prefix/suffix
So that is what " through the cmd prompt." meant - sorry.Well, if that was the problem, he wouldn't get the cmd prompt.
Then I guess we have to use full paths:
Code: Select all
Parameters: /k ren %P%N "%T%M:~-0,255.%E"
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Rename file on right panel the same as file on left panel + prefix/suffix
petermad,
I don't think that's necessary if the Start path is cleared.
Roman
I don't think that's necessary if the Start path is cleared.
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Rename file on right panel the same as file on left panel + prefix/suffix
You are right. And my suggestion doesn't work because the new filename cannot have a path.Hacker wrote: 2023-05-15, 12:20 UTC petermad,
I don't think that's necessary if the Start path is cleared.
But this:
Code: Select all
Command: %COMSPEC%
Parameters: /k ren %P%N "%M:~-0,255.%E"
Last edited by petermad on 2023-05-15, 13:28 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Rename file on right panel the same as file on left panel + prefix/suffix
petermad,
Roman
What does the & do? Or is that a typo?&COMSPEC%
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Rename file on right panel the same as file on left panel + prefix/suffix
Sorry - it was a typo - corrected now.What does the & do? Or is that a typo?
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar