RFC on MRT: better execute 'S&R' at first?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

RFC on MRT: better execute 'S&R' at first?

Post by *wanderer »

I have 5 files which all have a common string in the filename. My aim was to remove this string from the end of each filename and place it in the start. So, i performed the following steps:

- Selected the files in a TC file panel
- Opened MRT
- Search for: Test1
- Replace with: <blank>
- Rename mask: Test1[N]

The result was that TC first added Test1 in the beginning of the filename and then executed the "search for" / "replace with" part which actually removed it completely from the destination filename, that is from both the end (which already existed) and from the beginning (which i had just added).

I can do what i describe above in two steps. The question is: is the behavior of MRT convenient as is now or it would be better if it was changed to execute "search for" / "replace with" BEFORE parsing the rename mask?
Last edited by wanderer on 2016-09-29, 13:37 UTC, edited 1 time in total.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

'RCF' ?, did you meant "RFC" (Request for Change)?


Me think, your RFC is too special for this MRT, there are other renamers
where you can control in which order they perform the actions.
But I am not against an check box "[x]S&R first". (as the current behavior is utilized already sometimes)


For your case, you can do that in one step:

File name: Test1 [N]
Extension: [E]
Search: ' Test1$'
Replace: <Clear>
[_]E
[X]RegEx

OR

File name: [N]
Extension: [E]
Search: ^(.+) Test1$
Replace: Test1 $1
[_]E
[X]RegEx


OR more flexible

File name: [N]
Extension: [E]
Search: ^(.+) (.+)$
Replace: $2 $1
[_]E
[X]RegEx

OR

Utilize MRTs' 'Edit names' utility first.



 
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

Stefan2 wrote:'RCF' ?, did you meant "RFC" (Request for Change)? 
Well, i aimed for "Request For Comments", but... :)

I admit i have to try your suggestions but i assume they all work fine.

Personally i like your idea of having a "[x]S&R first" check box or something similar, even though i can't think of a situation where replacing you own input would be helpful (as currently done). Actually that was the main intention of this post, to get some cases in which the way it works now would actually be desired.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Ah, yes, 'for Comments' was the meaning of RFC in the IT.

-

There was some workarounds to use S&R as addition to [N].[E] to solve a need.
For example at the time before that "[X]E" checkbox were there.
Maybe I can dig out some from the forum archive....





 
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed search&replace is applied after the name field.
There is another simple way to handle this:
Name: Test2[N]
Search for: Test1|Test2
Replace with: |Test1

This will replace the (old) Test1 with nothing, and the new Test2 at the start with Test1.
Author of Total Commander
https://www.ghisler.com
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

ghisler(Author) wrote:Indeed search&replace is applied after the name field.
There is another simple way to handle this:
Name: Test2[N]
Search for: Test1|Test2
Replace with: |Test1

This will replace the (old) Test1 with nothing, and the new Test2 at the start with Test1.
Well, the problem in my case is that there is no Test2. Only Test1 exists and i simply wish to transfer it from the end of all files to the beginning. :)

I suspect there is no simple way to achieve that. Perhaps it can be achieved only through RegEx, which seems a little complicated for such a simple task.

I support Stefan's idea of a "[x]S&R first" checkbox if it's not too much trouble.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Well, the problem in my case is that there is no Test2. Only Test1 exists and i simply wish to transfer it from the end of all files to the beginning.
Did you actually TRY my reply? There is no Test2 in my case either, it just gets added at the beginning, and gets immediately replaced by Test1.
Author of Total Commander
https://www.ghisler.com
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

ghisler(Author) wrote:Did you actually TRY my reply? There is no Test2 in my case either, it just gets added at the beginning, and gets immediately replaced by Test1.
Yup i did, but i must have entered something wrong because i tried it again and now it worked. :?

Anyway, i see what you did there. Nice trick and it does what i need in a simple way. Thanks.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
Post Reply