Removing text after and including a bracket

Bulk Rename Utility How-To's

Removing text after and including a bracket

Postby DJSolidSnail » Fri Dec 29, 2023 5:18 pm

Hello.

Basically, I have a folder of films with the name of the film, then in brackets after the director and year, i.e. "2001 - A Space Odyssey (Stanley Kubrick, 1968)". However, this makes it difficult for my Plex media server to match them, so I'm looking to delete the bracketed bit, but I'd rather do this in bulk as it's proving prohibitively time-consuming to do it individually. Is there a way to delete the bracketed bits in bulk?

Also, how do I replace, say, "Deer Hunter, The" with "The Deer Hunter" in bulk, in other words swapping my The's around?

Much obliged.
DJSolidSnail
 
Posts: 1
Joined: Fri Dec 29, 2023 5:10 pm

Remove ending (text)

Postby Luuk » Sat Dec 30, 2023 1:12 am

To remove the ending (text), RegEx(1) can use a "Match" and "Replace" like...
(.+) \([^()]+\)$
\1

To put "The" at the very beginning, the "Match" and "Replace" can look like...
(.+), (The)(\b.*)
\2 \1\3
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Removing text after and including a bracket

Postby Gpizano » Sat Jan 20, 2024 9:47 am

Ok... so I want to be able to achieve the same thing as the OP, but I cannot for the sake of me, figure out what you are saying in your solution. Could you "dumb it down" for me?
Gpizano
 
Posts: 2
Joined: Sat Jan 20, 2024 9:44 am

Re: Removing text after and including a bracket

Postby Admin » Sun Jan 21, 2024 10:51 am

Hi can you give a few renames examples, before and after? thanks
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm

Re: Removing text after and including a bracket

Postby Gpizano » Mon Jan 22, 2024 6:38 pm

Here are a couple examples:

A-E (1982)(Broderbund)(Side A)[cr Blade].dsk
Beyond Floppy (19xx)(Greg Hale - Ted Cohn)[cr Great Lake Alliance].dsk

So, ultimately I would like to strip out anything between the brackets (including the brackets) but retaining the name and disk extension.
So, the first file would end up being:
A-E.dsk
and the second one would be:
Beyond Floppy.dsk

Thanks for any info you may have!
Gpizano
 
Posts: 2
Joined: Sat Jan 20, 2024 9:44 am

Re: Removing text after and including a bracket

Postby Admin » Tue Jan 23, 2024 1:07 am

BRU could truncate everything after the first ' (' ? Would that do it ?

If so, you can use:

RegEx (1)
Enable Simple flag
Match: %1 (%2
Replace: %1

Which means: match some text (%1) followed by a space and parentheses, followed by some more text (%2), then replace all with the first text matched (%1)
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm


Return to How-To


cron