Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friendly

English support forum

Moderators: white, Hacker, petermad, Stefan2

9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friendly

Post by *9kvD38n6 »

I've often thought that it would be more comfortable if the extension were generally handled separately from the filename, i. e. if there was a second text field containing only the extension in rename dialogs. That would make editing filenames a good deal more comfortable as the extension often gets in the way in my experience when moving forward and then back again to the end of the string (with {End} etc.). Perhaps changing the extension should also be a separate command from Rename in general. (I know, maybe not a popular opinion!) Many of us have probably experienced unintentional changes to the file extension over the years.

Alternatively, it would be helpful if there were two different keystrokes for moving to the end of the text field (after the extension) and moving between the filename and the extension, say End and Alt-End. Probably jumping to the dot should actually be the default action for End. Currently, End followed by Strg-Left seems to be the best way to navigate to the latter position, but currently this does not work with Rename in the file list.

It would be interesting to know the percentage of rename actions by users that end up actually changing the extension - a single digit percentage?

The option to highlight only the filename but not the extension when renaming in place is only helpful when it's not a complex change, i. e. when the user doesn't have to come back to the end of the file name after first moving forward. When you change your mind in between and want to go back to the end of the filename to change / add characters, things start to get messy with the extension. You have to press End and cursor Left a couple of time to get there.

Attached image is a screenshot of how this is handled in Irfanview - much more to my liking.

Image: https://imgur.com/a/L7dZ1pK
Last edited by 9kvD38n6 on 2024-02-08, 15:29 UTC, edited 1 time in total.
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *Dalai »

Pressing F5 or F6 in the rename dialog repeatedly switches the selection between file+extension, only file (basename), and everything (full path). This way oe can avoid renaming the extension by accident.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *9kvD38n6 »

Interesting, thanks for pointing this out.

However, the very fact that on a single keypress of F6, the dialog pops up with the full target path selected and that a second press is required to select only the file name is a case in point IMHO. How likely is the user to want to manually type in a full path different from the target folder? In the vast majority of cases when user does not simply accept the suggested full path with {Enter}, user will want to change only the file name. So it would make the most sense to start with only the file name selected, no? Even if user were to type in a custom path + file name, how likely would they be to also want to change the file type at the same time? Hence having that selected, too, seems counterproductive in the majority of cases.

In-place rename (Shift-F6) does select only the file name. So far so good, but in the many cases when I only make minor changes to the file name rather than completely replace it, having {End} move past the '.' is annoying and when you want to add characters to the end of the file name (which I often end up doing), you have to be much more mindful of correctly positioning cursor than if the extension was ignored by this command and could be changed explicitly via a different command.
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *Hacker »

9kvD38n6,
having {End} move past the '.' is annoying and when you want to add characters to the end of the file name
You can also press Right arrow.

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.
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *Dalai »

9kvD38n6 wrote: 2023-09-10, 20:14 UTCHow likely is the user to want to manually type in a full path different from the target folder?
For me this is very likely. I often move files into a subfolder of the current folder (instead of the opposite pane), so I just need to type "subfoldername\" and press Enter. TC then creates the subdir (if it doesn't exist) and moves the selected objects into that subdir.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *9kvD38n6 »

Hacker wrote: 2023-09-10, 20:23 UTC 9kvD38n6,
You can also press Right arrow.
Am well aware of that, thanks. But it doesn't help when you've edited elsewhere before you want to get back to the end of the file name.
9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *9kvD38n6 »

Dalai wrote: 2023-09-10, 22:43 UTC
9kvD38n6 wrote: 2023-09-10, 20:14 UTCHow likely is the user to want to manually type in a full path different from the target folder?
For me this is very likely. I often move files into a subfolder of the current folder (instead of the opposite pane), so I just need to type "subfoldername\" and press Enter. TC then creates the subdir (if it doesn't exist) and moves the selected objects into that subdir.
Not my style but an intersting use case. I'm not saying at all that this should be made impossible. However, it pertains to moving files rather than renaming.

My point is simply that for rename, I think that a simple, basic rename option with the file name in its own edit box without the extension would make the most sense to me. Put the extension into a separate edit box in the same dialog if you will or implement a separate command to change the file type. In fact, I'd be happy with just having an option to exclude the extension from Shift-F6 inline renaming. Then I could use the F6 rename / move dialog in case I wanted to change file type. Does that make sense or am I a minority of 1?
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *Dalai »

9kvD38n6 wrote: 2023-09-11, 08:22 UTCIn fact, I'd be happy with just having an option to exclude the extension from Shift-F6 inline renaming.
Sure, I had the same idea. The thing with such an option is that the use case may vary. Sometimes you might want to rename only the basename, other times you may want to move files. Either of these cases then requires an extra key press before you can go on. To be clear, I'm not saying this isn't the case currently. Everything has its pros and cons.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
mhe
Junior Member
Junior Member
Posts: 70
Joined: 2003-02-16, 15:09 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *mhe »

If hitting F2 (i use that for in place rename) once got me to only change filename, and hitting F2 twice got me to only change the extension, i'd definitely enable that option.
As you said it would make the end key more useful when editing file names, it's a minute detail for me, but sure if it was available i'd use it.
9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *9kvD38n6 »

Thanks for chiming in. Like I said in the title, I think it would ultimately also make rename safer to use - a typo in the file name has less potential of completely side-tracking a file than an accidental change to the extension.
9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *9kvD38n6 »

Found another use case where the current modus operandi is annoying: truncating a file name.

Say the file name is "Keychron-V10-75-Percent-Alice-Layout.webp" and you want to shorten it to just "Keychron-V10.webp", the extension being there really gets in the way. With in-place rename, after you've moved the cursor to the right of the "10", you have to press Shift-End, then Shift-Left five times, then Delete - instead of just Shift-End and Delete (if the intention were handled through a second edit box). Sadly, Shift-End Shift-Ctrl-Left can't currently be used as for some reason the '.' is handled like a word character by the control.
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *sa16 »

9kvD38n6 wrote:My point is simply that for rename, I think that a simple, basic rename option with the file name in its own edit box without the extension would make the most sense to me.
Use the Multi-Rtname Tool. Button with the TCFS2:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe
/ef "tcm(524) set_ini(`%%COMMANDER_PATH%%\usercmd.ini`, em_temp, cmd, `MULTIRENAME $tmp`) set_tcini(Rename, $tmp_name, `"%O"`) set_tcini(Rename, $tmp_ext, `"%E"`) set_tcini(Rename, $tmp_params, `0|1|1|1`) set_tcini(Rename, $tmp_search, `*\`) set_tcini(Rename, $tmp_replace) tem(em_temp)"
WCMICONS.DLL,46
Rename file under cursor


-1
Last edited by sa16 on 2023-09-21, 15:58 UTC, edited 1 time in total.
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *Fla$her »

29kvD38n6
Try such a vbs (maybe it will do):
RenBaseNameOrExt.vbs

Code: Select all

'——————————————————————— VBS ———————————————————————
' Rename the base name or extension under the cursor
' Parameters: %P%N [/e]
' /e — rename the extension instead of the base name
'————————————————————————————— Author: Flasher © ———

Option Explicit
Dim Title, N, E, Y, F, P, Ext, BN, Text, Er, NN
Title = " Renaming an object under the cursor"
With WSH.Arguments
   If .Count = 0 Then MsgBox "Add %P%N as a parameter!", 262192, Title: WSH.Quit
   N = .Item(0): E = .Named.Exists("e")
End With

With CreateObject("htmlfile")
   Y = 96/.Parentwindow.Screen.deviceYDpi
   Y = 15*Y*(.Parentwindow.Screen.Height-188*Y)/2
End With

With CreateObject("Scripting.FileSystemObject")
   If .FileExists(N)   Then Set F = .GetFile(N)   Else _
   If .FolderExists(N) Then Set F = .GetFolder(N) Else WSH.Quit
   P = .GetParentFolderName(N): N = .GetFileName(N)
   Ext = .GetExtensionName(N): BN = .GetBaseName(N)
End With

If E Then Text = "extension": N = Ext Else N = BN: Text = "base name"

With New RegExp
   .Pattern = "["":|?/<*>\\]"
   Do
      N = Trim(InputBox(vbLf & vbLf & Er & String(3, vbLf) & "Enter a new " &_
      Text & ":", Title, N,, Y))
      If Not E Then If N = "" Then WSH.Quit
      If .Test(N) Then Er = "Error: forbidden characters in the name!" Else Exit Do
   Loop
End With

If E Then
   If N = "" Then NN = BN Else NN = BN & "." & N
Else
   If Ext = "" Then NN = N Else NN = N & "." & Ext
End If
If F.Name <> NN Then
   F.Name = NN
   CreateObject("WScript.Shell").Exec "%COMMANDER_EXE% /S /O0 /P """ & P & "\" & NN & """"
End If
Overquoting is evil! 👎
9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *9kvD38n6 »

Thanks for the suggestions! I still think a native modification / option would be a step forward, but you guys got me thinking and I was able to find my own solution in Autohotkey, which works directly inside the in-place rename control. Pressing 'r' with focus on the file list (I've remapped the most frequent commands in TC to letter keypresses in the file list rather than using F-keys or similar - worth it for me over the default quicksearch feature) will send +{F6} for in-place rename, then read the contents of the resulting edit box, store the extension of the file being renamed in a global variable, remove the extension from the edit box, then re-select the bare file name. The file name (only) can now be replaced or edited.

Pressing {Enter} when inside the edit control will jump to the end of the file name and re-append the extension before completing the rename action. This also empties the variable for when I do want to change the file type. To do so, I can now actually press +{F6} to prevent AHK from removing the extension (as happens when I press 'r') or I could just use the mutli-rename tool.

Here's the code (not tested much yet):

Code: Select all

global TCRenExtNoPeriod := ""

#If (Win_GetFocusedClassName() = "TMyListBox" or Win_GetFocusedClassName() = "LCLListBox")
	$r:: ;; rename, storing and removing extension and adding it back in on enter being pressed
		Send, +{F6}
		Sleep, 60
		ControlGet, RenamePreset, Line, 1, Edit1, A
		SplitPath, RenamePreset, , , TCRenExtNoPeriod
		Send, {Right}+{End}{Delete}^a
	return

#If (Win_GetActiveClass() = "TTOTAL_CMD" and Win_GetFocusedClassNN() = "Edit1")
	$Enter:: ;; re-append the extension before confirming edit
		Send, {End}.%TCRenExtNoPeriod%{Enter}
		TCRenExtNoPeriod := ""
	return
	$Enter Up:: return
9kvD38n6
Junior Member
Junior Member
Posts: 89
Joined: 2010-09-03, 08:23 UTC

Re: Separate commands for renaming files (folders) and for changing the file extension would be safer / more user-friend

Post by *9kvD38n6 »

Have been using this AHK code for a couple of months now to escape the mess of file extensions getting in the way with the default file rename commands and it really makes the process a lot more convenient!

Have made some additions to the code:
- Had to make cancelling rename with Escape keypress clear the variable in which the file extension is stored while editing the file name.
- Have addded 'duplicate current file' hotkey to clone the current file and instantly trigger the improved rename command.

Following is the current code in case anyone wants to try it out. You'll probably want to change the d and r hotkeys to something different if you're still wasting the alpha keypresses in the file list on the quicksearch feature. (I now invoke quicksearch by pressing s when I need it - this frees up all the other alpha keys for useful commands when in the file list.)

Code: Select all

global TCRenExtNoPeriod := ""

$d:: ;; duplicate file
	Send +{F5}{Right}-{Enter}
	Sleep, 400
	Send, +{F6}
	Sleep, 60
	ControlGet, RenamePreset, Line, 1, Edit1, A
	SplitPath, RenamePreset, , , TCRenExtNoPeriod
	Send, {Right}{Left}+{End}{Delete}^a
return

$r:: ;; rename, storing and removing extension and adding it back in on enter being pressed
	Send, +{F6}
	Sleep, 60
	ControlGet, RenamePreset, Line, 1, Edit1, A
	SplitPath, RenamePreset, , , TCRenExtNoPeriod
	Send, {Right}+{End}{Delete}^a
return

#If (Win_GetActiveClass() = "TTOTAL_CMD" and Win_GetFocusedClassNN() = "Edit1")
	$Enter:: ;; re-append the extension before confirming edit
		Send, {End}.%TCRenExtNoPeriod%{Enter}
		TCRenExtNoPeriod := ""
	return
	$Enter Up:: return
	$~Escape:: TCRenExtNoPeriod := ""
Post Reply