How to remove the last character from a file name

Bulk Rename Utility How-To's

How to remove the last character from a file name

Postby SoCu » Mon Dec 15, 2025 6:39 pm

Hello, I apologize for the translation; I am using a translator, but I hope it is understandable.
I have different file names, in this case MP3 files, many of which end with the character _ for example:
text_ text_ text- text_text_.mp3
text_ text text_text_.mp3

The application could be configured to remove the last character, but I can't do that because there are many files that don't have that final character, for example:
text_text_text.mp3
text text text text text.mp3


How can the application be configured to remove the last character _ before the extension?

Thank you.
SoCu
 
Posts: 7
Joined: Mon Dec 15, 2025 6:20 pm

Re: How to remove the last character from a file name

Postby TheGhost78 » Mon Dec 15, 2025 7:42 pm

Remove (5):

Last n: 1
TheGhost78
 
Posts: 249
Joined: Fri Jul 19, 2024 11:25 am

Re: How to remove the last character from a file name

Postby therube » Mon Dec 15, 2025 7:43 pm

3:Replace
Code: Select all
Replace:  \last\_.
With: .



Alternatively, you could set up a Filter.

12:Filter, Mask: *_.*, which would only display your expected file names.


(Both of above require, Renaming Options, File/Folder Extensions -> Rename File Extensions As Being Part of File Name, to be enabled.)

Or...

1:Regex, enable Simple
Code: Select all
Match:  %1_.%2
Replace:  %1.%2
therube
 
Posts: 1451
Joined: Mon Jan 18, 2016 6:23 pm

Re: How to remove the last character from a file name

Postby SoCu » Mon Dec 15, 2025 8:18 pm

Thanks for responding.
TheGhost78, that's the option I mentioned earlier. If I use it to delete the last character of the name, it does delete the _, but it also deletes the last character of files that don't have the _

Image

therube, I don't know if I'm doing it right, but it doesn't remove the last character.

Image
SoCu
 
Posts: 7
Joined: Mon Dec 15, 2025 6:20 pm

Re: How to remove the last character from a file name

Postby SoCu » Mon Dec 15, 2025 8:28 pm

I can't edit the previous post, so I'll create a new one...
Okay, I haven't seen the second part of therube, but when I apply the filter to only show those files, TheGhost78's option works.

I'll keep trying to test the option in section 1: Regex, enable Simple, but I can't get any change.
SoCu
 
Posts: 7
Joined: Mon Dec 15, 2025 6:20 pm

Remove _ as last filename character

Postby Luuk » Tue Dec 16, 2025 3:32 am

The easiest way is probably using Replace(3) and a "Replace" like... \end\_
Or with RegEx(1) having the 'v2' checkmark, can use a "Match" like... _$
Luuk
 
Posts: 838
Joined: Fri Feb 21, 2020 10:58 pm

Re: How to remove the last character from a file name

Postby TheGhost78 » Tue Dec 16, 2025 2:12 pm

Sorry, I obviously only half-read the post!
TheGhost78
 
Posts: 249
Joined: Fri Jul 19, 2024 11:25 am

Re: How to remove the last character from a file name

Postby TheGhost78 » Tue Dec 16, 2025 2:48 pm

You could add:

_.mp3$

in Filters (12) - with RegEx ticked, along with Files and Subfolders.

That way, only mp3 files ending with an underscore will be displayed.
TheGhost78
 
Posts: 249
Joined: Fri Jul 19, 2024 11:25 am

Re: How to remove the last character from a file name

Postby SoCu » Tue Dec 16, 2025 3:19 pm

Thank you all very much. I honestly don't know where you get all that code from, although you then have to understand it, haha, but it's amazing what configuration options you can achieve with this program.

I'm going to open another post to ask about something I've been trying to do for a while and I don't know if BRU can do
SoCu
 
Posts: 7
Joined: Mon Dec 15, 2025 6:20 pm


Return to How-To