Invert pattern

Advanced Renamer forum
#1 : 30/04-22 14:49
Paul Panther
Paul Panther
Posts: 7
Hi,
I have many files, each with the same name extension. How can I now reverse the "Remove Pattern"?

MyNameIsA_12mm_Diffuse_1
MyNameIsB_12mm_Diffuse_2
MyNameIsC_12mm_Diffuse_3

With Remove Pattern
MyNameIsA_12mm_
MyNameIsB_12mm_
MyNameIsC_12mm_

Diffuse_1
Diffuse_2
Diffuse_3

How can I now reverse the "Remove Pattern"? Target Diffuse_1, Diffuse_2, Diffuse_1



30/04-22 14:49
#2 : 30/04-22 16:17
David Lee
David Lee
Posts: 1125
Does anyone ever bother to read the UserGuide?

It should be blindingly obvious - whatever pattern you have used in the Remove pattern method just apply it to a NEW Name method!


30/04-22 16:17
#3 : 01/05-22 14:18
Paul Panther
Paul Panther
Posts: 7
Reply to #2:
Is it?

To make it clear:

I have several folders with subfolders. In these subfolders are several files, which always end with Diffuse_1, Diffuse_2, Diffuse_3 and Normal_1, Normal_2 and Normal_3.

FOLDER 1
MyNameIsA_12mm_Diffuse_1
MyNameIsB_12mm_Diffuse_2
MyNameIsC_12mm_Diffuse_3
MyNameIsA_12mm_Normal_1
MyNameIsB_12mm_Normal_2
MyNameIsC_12mm_Normal_3

FOLDER 2
MyNameIsA_12mm_Diffuse_1
MyNameIsB_12mm_Diffuse_2
MyNameIsC_12mm_Diffuse_3
MyNameIsA_12mm_Normal_1
MyNameIsB_12mm_Normal_2
MyNameIsC_12mm_Normal_3

Now I want to remove the prefix Diffuse_1 from all files. Then the files are renamed. So, the names Diffuse_1, Normal_1 etc. are needed (<name>).


FOLDER 1
Diffuse_1
Diffuse_2
Diffuse_3
Normal_1
Normal_2
Normal_3

FOLDER 2
Diffuse_1
Diffuse_2
Diffuse_3
Normal_1
Normal_2
Normal_3

After that, I will use "New Name" with <DirName> tags.
<DirName:4> <DirName:2> <DirName:3> <DirName:1> <Name>
FolderX_FolderY_FolderZ_Folder1_Diffuse_1


01/05-22 14:18
#4 : 01/05-22 22:17
David Lee
David Lee
Posts: 1125
Reply to #3:
Yes totally obvious - particularly since you claim that you already have a pattern that will remove the suffixes.

Replace: .*_(.*_.*)$
with: \1
Use regular expressions



01/05-22 22:17
#5 : 02/05-22 08:28
Paul Panther
Paul Panther
Posts: 7
Reply to #4:
Thanks David!!

I'm not a dev or anything. That's why not everything makes sense for me. But thanks again. Really helpful and I do appreciate your help.


02/05-22 08:28