How to remove brackets witin a file name or folder

Bulk Rename Utility How-To's

How to remove brackets witin a file name or folder

Postby Ronstang » Fri Sep 23, 2022 4:43 am

I have a lot of folders named as such:

Gorky Park [MGMHD]+5
Howling II Your Sister Is a Werewolf [MGMHD]+

And I need to remove just the brackets and leave everything else the same so the results would become:

Gorky Park MGMHD+5
Howling II Your Sister Is a Werewolf MGMHD+

But not all have the same thing within the brackets, neither in number of letters or which specific letters.

Thanks
Ronstang
 
Posts: 45
Joined: Tue Feb 09, 2021 2:14 am

Remove brackets

Postby Luuk » Fri Sep 23, 2022 10:03 am

Greetings Ronstang.
To remove all of the brackets, can just use Chars==[] inside of the Remove(5).
To remove all brackets when a + follows, the RegEx(1) wants a checkmark for v2, so then a 'Match' and 'Replace' like...
\[([^]]*)\](?=\+)/g
$1

To remove brackets at the very end, when a + follows, and then maybe 1-digit, the 'Match' and 'Replace' can be more like...
\[([^]]*)\](?=\+\d?$)
$1
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: How to remove brackets witin a file name or folder

Postby Admin » Fri Sep 23, 2022 11:45 am

Hi you could also use a Simple Regex:
Match: %1[%2]%3
Replace: %1%2%3
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm

Re: How to remove brackets witin a file name or folder

Postby Ronstang » Fri Sep 23, 2022 7:29 pm

Thanks so much to both of you....I just renamed a thousand files in a few minutes, would have been seconds if they weren't spread across a bunch of directories. :D :D
Ronstang
 
Posts: 45
Joined: Tue Feb 09, 2021 2:14 am


Return to How-To