Page 1 of 1

Trim after a specific character

PostPosted: Mon Feb 05, 2024 1:40 pm
by renamewhat
Hello, need some help, I have this kind of name pattern:

Test_01_47-06_9ae2384b
Test_01_47-07_df995
Test_01_47-09_a6a

I need to rename these folders so they look like this:

Test_01_47-06_
Test_01_47-07_
Test_01_47-09_

Basically everything should be trimmed after the third _ character.

Any help would be appreciated. Thanks

Re: Trim after a specific character

PostPosted: Tue Feb 06, 2024 5:24 am
by Admin
RegEx (1)
Enable Simple

Match: %1_%2_%3_%4
Replace: %1_%2_%3_

Re: Trim after a specific character

PostPosted: Tue Feb 06, 2024 8:19 am
by renamewhat
Thank you so much.

Re: Trim after a specific character

PostPosted: Wed Apr 10, 2024 7:48 am
by frankliniwobi
Please what if I want to move everything after the extension to before the eztension and format it? For example, I have

capabilities.jpg&w=2048&q=75
logo.jpg&w=657&q=75
bg.jpg&w=1080&q=85

And want to change it to

capabilities-w-2040-q-75.jpg
logo-w-657-q-75.jpg
bg-w-1080-q-85.jpg

How do I achieve it?

Convert/Move extra characters after extensions

PostPosted: Thu Apr 11, 2024 3:33 am
by Luuk
@Frankliniwobi
First to put a checkmark inside for the menu... Renaming Options, File/Folder Extensions, Rename File Extensions.
Then for your examples, Regex(1) could use a "Match" and "Replace" like...
(.+)(\.jpg)&(w)=(\d+)&(q)=(\d+)$
\1-\3-\4-\5-\6\2

After finished renaming, its always best to remove the checkmark for renaming extensions.

Re: Trim after a specific character

PostPosted: Sat Apr 20, 2024 1:58 pm
by frankliniwobi
@Luuk

Thank you very much, it worked perfectly :D

I have another question, there's a folder with similar type of files but this time around I want to remove everything after the extension.

For example,

capabilities.jpg&w=2048&q=75
logo.jpg&w=657&q=75
bg.jpg&w=1080&q=85

Converted to

capabilities.jpg
logo.jpg
bg.jpg

I tried to modify the previous code from

(.+)(\.jpg)&(w)=(\d+)&(q)=(\d+)$
\1-\3-\4-\5-\6\2

to

(.+)(\.jpg)&(w)=(\d+)&(q)=(\d+)$
\1\2

But it did not work, Please help

Convert/Move extra characters after extensions

PostPosted: Sat Apr 20, 2024 10:53 pm
by Luuk
@Frankliniwobi
Can just put a checkmark back inside for renaming the file extensions.