Insert Character relative to the end of the filename

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Insert Character relative to the end of the filename

Postby dexterdom » Thu Aug 13, 2020 5:54 pm

Hi there, I'm a long time user of BRU, it's fantastic!

I'm hoping this is possible...
I would like to add a character relative to the end of the filename, as opposed to from the beginning.
To be specific, I have a list of movie files (which of course have filenames of varying lengths) in the format "my movie title 2009.mp4" and I want the year to be in parentheses, like so: "my movie title (2009).mp4"
Using the Add function, I can add ")" using the Suffix parameter, but I can't figure how to add a "(" five characters from the end of the filename (since the "at" parameter is only relative to the start of the filename).
Any suggestions would be much appreciated.
Thanks!
dexterdom
 
Posts: 4
Joined: Thu Aug 13, 2020 5:41 pm

Re: Insert Character relative to the end of the filename

Postby therube » Thu Aug 13, 2020 9:06 pm

1:RegEx:
Code: Select all
Match:  (.*)\s(\d\d\d\d)$
Replace:  \1 (\2)


Find anything
Up to a <sp>4-digits.
Enclose the digits in parens

---

7:Add, while you can enter a negative "at", doing so does not make it work backwards.

---

If you've already go the closing paren in there, you could change things up:
Code: Select all
Match:  (.*)(\d\d\d\d\))(.*)
Replace:  \1(\2\3


---

Another slightly different variation, where the year in not at the end of the file name (nor at the start).

1:RegEx:
Code: Select all
Match:  (.*)\s(\d\d\d\d)\s(.*)
Replace:  \1 (\2) \3

Find anything
Up to a sequence of <sp>4-digits-<sp>
Followed by anything else

Stick the 4-digits into parenthesis
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Insert Character relative to the end of the filename

Postby dexterdom » Fri Aug 14, 2020 2:11 am

Thank you for this, I'm very rusty with my regular expressions but this is very helpful! Yes I actually did try entering a negative number in the "at" field, but it wouldn't take it (the field just goes blank). Adding this as part of the GUI I think would be helpful, maybe I'll submit it over in the Suggestions forum. Thanks again
dexterdom
 
Posts: 4
Joined: Thu Aug 13, 2020 5:41 pm

Re: Insert Character relative to the end of the filename

Postby dexterdom » Fri Aug 14, 2020 2:22 am

Just an update regarding using a negative "at". Instead of manually typing a negative number into the field, I instead tried using the down arrow to count down below zero, and it worked! So if I use -5 for "at", it inserts the character at the fifth position from the end of the filename.
dexterdom
 
Posts: 4
Joined: Thu Aug 13, 2020 5:41 pm

Re: Insert Character relative to the end of the filename

Postby Admin » Fri Aug 14, 2020 2:27 am

Hi, confirmed, it is a bug and we will fix it. It should be possible to type in a negative position in the at field without using the arrows... negative means "from the end", thanks
Admin
Site Admin
 
Posts: 2351
Joined: Tue Mar 08, 2005 8:39 pm

Re: Insert Character relative to the end of the filename

Postby dexterdom » Fri Aug 14, 2020 2:58 am

Great news and thanks for the quick reply!
dexterdom
 
Posts: 4
Joined: Thu Aug 13, 2020 5:41 pm

Re: Insert Character relative to the end of the filename

Postby therube » Sat Aug 15, 2020 5:05 pm

Just an update regarding using a negative "at".

Heh, I see what I did (wrong) in that respect (why it did not work for me), heh, I mistakenly put the ( in Prefix rather then in Insert.


As far as the bug, viewtopic.php?f=4&t=3545 ;-).
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm


Return to BRU Support