RFC on MRT: better execute 'S&R' at first?
Moderators: white, Hacker, petermad, Stefan2
RFC on MRT: better execute 'S&R' at first?
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?
- 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.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
'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.
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.
Well, i aimed for "Request For Comments", but...Stefan2 wrote:'RCF' ?, did you meant "RFC" (Request for Change)?
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.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
- ghisler(Author)
- Site Admin
- Posts: 48232
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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.
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
https://www.ghisler.com
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.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.
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.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
- ghisler(Author)
- Site Admin
- Posts: 48232
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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.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.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Yup i did, but i must have entered something wrong because i tried it again and now it worked.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.
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.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.