Counter in 'Search and Replace'? (Multi-Rename Tool)
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 92
- Joined: 2004-06-27, 15:24 UTC
Counter in 'Search and Replace'? (Multi-Rename Tool)
Hi!
Is it possible to replace a specified text by a counter using 'Search and Replace' in Multi-Rename Tool? (I can't find a way how can I enter the counter in 'Replace With...' field.)
I can give an example: I have some selected files with numbers in their names like this:
test02.txt
01test.txt
te18st.txt
I want to replace all the digits with a counter. What is the best way to perform this? I was thinking about enabling RegExes and entering '\d\d' in 'Search for...' field and a counter in 'Replace with...' filed. But I have no idea how to use the counter in 'Search and Replace'...
Is it possible to replace a specified text by a counter using 'Search and Replace' in Multi-Rename Tool? (I can't find a way how can I enter the counter in 'Replace With...' field.)
I can give an example: I have some selected files with numbers in their names like this:
test02.txt
01test.txt
te18st.txt
I want to replace all the digits with a counter. What is the best way to perform this? I was thinking about enabling RegExes and entering '\d\d' in 'Search for...' field and a counter in 'Replace with...' filed. But I have no idea how to use the counter in 'Search and Replace'...
CU
VK
VK
-
- Junior Member
- Posts: 92
- Joined: 2004-06-27, 15:24 UTC
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
Re: Counter in 'Search and Replace'? (Multi-Rename Tool)
And how should the look after rename ?Valery_Kondakoff wrote:I can give an example: I have some selected files with numbers in their names like this:
test02.txt, 01test.txt, te18st.txt
like test 01.txt, test 02.txt, test 03.txt?
If thats the case I would do it as followed:
Enter in the field Name: "[N] [Caa]"
In the field Search for "\d" (one \d is enough

In the field Replace with: "nothing"
Enter and than Press F5
Clear the fields Search for and Replace with
Enter in the field Name: "[N1--4] [C:2]"
(all Strings without(!) "

Hoecker sie sind raus!
@Valery_Kondakoff:
1. ignore the file extension when searching and replacing
2. add a possibility to chain replacements when RegEx is activated like it can already be done using the "normal" search and replace.
http://www.ghisler.ch/board/viewtopic.php?t=7464#59499
Additionally I'd like to do replacements using the plugins for example, endless possibilities if you ask me, the MRT is far from being perfect.
Icfu
Of course it is, I have supported two requests for the MRT in the German forum yesterday to extend the functionality like this:Hmm... This means, that currently it is impossible to replace the found substring with some placeholder (like counter)? Don't you think this is an area for future improvement?
1. ignore the file extension when searching and replacing
2. add a possibility to chain replacements when RegEx is activated like it can already be done using the "normal" search and replace.
http://www.ghisler.ch/board/viewtopic.php?t=7464#59499
Additionally I'd like to do replacements using the plugins for example, endless possibilities if you ask me, the MRT is far from being perfect.
Icfu
This account is for sale
-
- Junior Member
- Posts: 92
- Joined: 2004-06-27, 15:24 UTC
Re: Counter in 'Search and Replace'? (Multi-Rename Tool)
No, in this example I just wanted to replace all available digits with incremented counter. Like this:Sir_SiLvA wrote:And how should the look after rename ?
like test 01.txt, test 02.txt, test 03.txt?
test01.txt
02test.txt
te03st.txt etc... - this is just an example of renaming scheme currently impossible by TC.
BTW: IMHO your example will not work, just because if you replace all '\d' with 'nothing' all the files will have the same name (test.txt) which will produce unexpected results as far as I can understand.
CU
VK
VK
Re: Counter in 'Search and Replace'? (Multi-Rename Tool)
Do you need some glasses ?Valery_Kondakoff wrote:BTW: IMHO your example will not work, just because if you replace all '\d' with 'nothing' all the files will have the same name (test.txt) which will produce unexpected results as far as I can understand.


Why Do you think if written 2 postings above
myself wrote:Enter in the field Name: "[N] [Caa]"

therefore my example works 100%...
Also I still dont know why someone should want to rename files
from test02.txt, 01test.txt, te18st.txt
to test01.txt, 02test.txt, te03st.txt?
ICFU is it possible to do this job with Oscar's FR?
But I think it would be nice if the Replace-with-box would
support all the [*]-Tags (a [ then would be entered with [[)
Anybody against/for it ?
Hoecker sie sind raus!
It is possible like this:
1. Copy all filenames to clipboard
2. Paste the filenames in some advanced text editor that supports counters
3. Replace using RegEx:
search for \d+
replace with Counter
4. Copy&paste editor output to Oscar's Renamer, same directory loaded of course
5. Press OK in Oscar's Renamer
Icfu
1. Copy all filenames to clipboard
2. Paste the filenames in some advanced text editor that supports counters
3. Replace using RegEx:
search for \d+
replace with Counter
4. Copy&paste editor output to Oscar's Renamer, same directory loaded of course
5. Press OK in Oscar's Renamer
Icfu
This account is for sale
-
- Junior Member
- Posts: 92
- Joined: 2004-06-27, 15:24 UTC
Re: Counter in 'Search and Replace'? (Multi-Rename Tool)
Yes, you are right. I have not noticed the '[N] [Caa]' part of your example.Sir_SiLvA wrote:therefore my example works 100%...
This was just a quick example. I was trying to illustrate the following problem: from time to time you need to use the regexps and placeholders at the same time. For example, to find a common strings in multiple filenames and add a counter to it. Imagine, that you need to rename these files:Also I still dont know why someone should want to rename files
from test02.txt, 01test.txt, te18st.txt
to test01.txt, 02test.txt, te03st.txt?
Valery_Birthaday_small.jpg
SmallValeryPic_large.gif
new_pic_of_Valery_small.png
to:
Valery_01_small.jpg
Valery_02_large.gif
Valery_03_small.png
The easyest way is to find a substrings using regexp '.*(Valery).*(.....\..*)' and replace the entire filename with regexp:
Code: Select all
$1_<2-digit counter>_$2
CU
VK
VK
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
True, but you can circumvent that by adding a counter plus unique string in front of each file name in TC before loading it in the editor so even if you change the order later in the external editor you can easily alphabetize it with no problem.
I think the topic starter isn't interested in workarounds anyway, too bad.
Icfu
I think the topic starter isn't interested in workarounds anyway, too bad.
Icfu
This account is for sale