Multirenaming Tool - [N] - for folders with dot

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

Multirenaming Tool for files:
[N] - filename
[E] - extension
Multirenaming Tool for folder:
[N] - part of foldername before of last dot
I know [A] - filename+extension, but when renaming files and folder - this inconvenient.
I want [N] for folders is fullname of folders name.
Example for [N]:
folder.1
folder.2

file1.ext
file2.ext
sa16
Senior Member
Senior Member
Posts: 215
Joined: 2021-09-10, 07:15 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *sa16 »

2monarch-lfv
If the file is: Readme_28.05.23?
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

2sa16
Files almost always have extensions. Folders do not have extensions.
To your question: the file "Readme_28.05.23" turns out to have the extension ".23" (which is most likely wrong in fact).
I mean folders, not files.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3278
Joined: 2003-05-06, 11:46 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *Sir_SiLvA »

monarch-lfv wrote: 2023-05-28, 11:42 UTC Multirenaming Tool for files:
[N] - filename
[E] - extension
Multirenaming Tool for folder:
[N] - filename
[E] - extension
for the file system folders are also files...
monarch-lfv wrote: 2023-05-28, 11:42 UTC I want [N] for folders is fullname of folders name.
It does - if you use folders with extensions thats not tcs fault :-)
Hoecker sie sind raus!
sa16
Senior Member
Senior Member
Posts: 215
Joined: 2021-09-10, 07:15 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *sa16 »

2monarch-lfv
It turns out that for a file you agree with cut 23, but for a directory Dir_28.05.23 you do not.
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

2Sir_SiLvA
I use folder with dots? example:
  • 2023.05.28
    anyprogram v.1.2.312
    e.t.c.
Here, the dot does not imply an extension, it is part of the folder name (namely, the folder name).
Along with such folders in the same directory, there may be similar files but with their own extensions (for example, zip, rar). If I set any rule for renaming, I expect that both folders and files will be processed equally correctly. But instead I get a different result.
Example:
  • Prog v10.0.0.35798_Final (this is folder)
    Prog v10.0.0.35798_Final.zip (this is file)
MRT: [N6-10] (and ext [E]) result:
  • v10.0.35798_Final
    v10.0.zip
Is incorrect. I know, that [A6-10] (and ext is empty) will give correct result. But I believe that by default the folder name should not be divided into name and extension.
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

2sa16
Yes, I think so.
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

Sorry, this is: [A6-10] (and ext is empty) won't give the right result either - zip extension will be lost.
How to be in that case?
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

Pure example:

Code: Select all

   Prog v10.0.0.35798          (folder)
   Prog v10.0.0.35798.zip      (file)
Rename to:

Code: Select all

   v10.0.0         (folder)
   v10.0.0.zip     (file)
The folder and file names are identical, except for the file extension (as all archivers usually do). That is, the renaming rule should also be essentially the same.
How to do it?
User avatar
petermad
Power Member
Power Member
Posts: 14743
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Multirenaming Tool - [N] - for folders with dot

Post by *petermad »

The folder and file names are identical
No the folder have the name Prog v10.0.0 and the extension 35798, the file has the name Prog v10.0.0.35798 and the extension zip.

Try and rename the folder Prog v10.0.0.35798 to Prog v10.0.0.35798.zip - that is not possible because a(nother) file with that name already exists.

You can accomplish your task with Search & Replace - like here; https://tcmd.madsenworld.dk/searchandreplace.png
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.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3278
Joined: 2003-05-06, 11:46 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *Sir_SiLvA »

monarch-lfv wrote: 2023-05-28, 14:07 UTC
  • 2023.05.28
    anyprogram v.1.2.312
    e.t.c.
Here, the dot does not imply an extension, it is part of the folder name (namely, the folder name).
Stop right there! At this point we have to differentiate between what you as human being expect
and what the FileSystem does! You expect anyprogram v.1.2.312 to be the complete filename
but for the filesystem EVERY file (as said before folders are just files) is Name(DOTExtension)
monarch-lfv wrote: 2023-05-28, 14:07 UTC Along with such folders in the same directory, there may be similar files but with their own extensions (for example, zip, rar). If I set any rule for renaming, I expect that both folders and files will be processed equally correctly. But instead I get a different result.
No, your are wrong as you get equally correct results which are just not the results you want!
https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathfindextensiona is
executed on both the same.

So what you want, is to suggest a new variable that "differentiates" between files and "folders".
But that would slow down TCs preview of the new filename as it had to check every file in
the list for being a "folder" and we all know how Christian likes stuff that slows TC down...
Hoecker sie sind raus!
Fla$her
Power Member
Power Member
Posts: 2254
Joined: 2020-01-18, 04:03 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *Fla$her »

monarch-lfv wrote: 2023-05-28, 14:40 UTC How to do it?
Only using WinScriptsAdv.

options.ini:

Code: Select all

[Script]
ActiveScripts=...|BaseName

[BaseName]
Script=BaseName.js
content=Base name
extensions=*
FoldersPaths=1
BaseName.js:

Code: Select all

with(WSH.createObject('Scripting.FileSystemObject')){if(fileExists(filename)){content=getBaseName(filename)}else{content=getFileName(filename)}}
Overquoting is evil! 👎
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

2petermad
The fact that you can get out of the situation in this way - I know. But, you see, for such a simple example, a rather "complicated" solution.

2Sir_SiLvA
I agree, in terms of the file system everything is as you say. But from the point of view of common sense - the folder does not need an extension, as such. After all, even the total commander itself displays the entire folder name in Name column, and does not put the extension in the appropriate column when displayed in Full mode, like files.
Sir_SiLvA wrote: 2023-05-28, 15:17 UTC But that would slow down TCs preview of the new filename as it had to check every file in
the list for being a "folder" and we all know how Christian likes stuff that slows TC down...
Maybe make a new parameter in the dialog box Multi-Rename tool for such cases? Although this will slow down the work, it will do the renaming as the user wishes.

2Fla$her
Thanks, about WinscriptAdv, I know that it is possible. You can get the full name, but use part of it - unfortunately not. Again to write (or edit) the script for the elementary operation?
I would like to see this functionality in the Total Commander itself. Since I think that this is a fairly simple case that many users face. Zip up any folders that contain dots in their names, and then try to rename with some sort of rule for name along with the files.
User avatar
petermad
Power Member
Power Member
Posts: 14743
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Multirenaming Tool - [N] - for folders with dot

Post by *petermad »

The fact that you can get out of the situation in this way - I know. But, you see, for such a simple example, a rather "complicated" solution.
Writing Prog |.35798 in the Search field seems less complicated than the WinscriptAdv approach. :wink:
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.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Multirenaming Tool - [N] - for folders with dot

Post by *monarch-lfv »

2petermad
Ok, let's make it a little more difficult:

Code: Select all

Fold v11.0.0.anyInformation     (folder)
Prog v10.0.0.35798              (folder)
Fold v11.0.0.anyInformation.zip (file)
Prog v10.0.0.35798.zip          (file)
Rename (character 6 to 10) to:

Code: Select all

v11.0       (folder)
v10.0       (folder)
v11.0.zip   (file)
v10.0.zip   (file)
Your method won't work anymore. It will be very labor intensive. It will be faster to manually rename. And the more such pairs of folders-files, the more impossible it is to automate (only with a script). Although it should look like a simple renaming procedure.
Post Reply