Rename - remove everything in bracket

Hi, how to rename file by "remove everything in bracket, including the bracket itself."

bracket could be ( )or [ ] type

Example of file name to replace:

01 (String) Song A (studio version).mp3 >> 01 Song A.mp3
02 (Rock) Song B [ Live concert].mp3 >> 02 Song B.mp3

Thank you.

Old name: (.*)( \(.*\)| \[.*\])(.*)#
New name: \1\3
Type: Regular expressions


Actually, this is probably a bit safer when there are multiple things in brackets:

Old name: (.*)( \([^)]*\)| \[[^\]]*\])(.*)#
New name: \1\3
Type: Regular expressions

1 Like

How come I can't find option to edit earlier post @_@

In addition, I also wish to know the way to "Remove any non-english character" in renaming.

I am new to Dir Opus, earlier I am using PFrank for renaming. It is powerful (the most could be) renaming software, but if Dir Opus can do the same then it will be very convenient for me.

Wow thx, this is impressive... I stare at the command and not knowing how it works :frowning:
Couldn't be everytime asking for help unless i can understand that >_<

See Various simple rename presets, number 5: Make Safe Name.

If you had edited your earlier post to add another question, I would not have noticed it and given you an answer, since I had already read your post. That is one of the reasons why you can't edit your own posts in this part of the forum.

The trick to regexps is to learn the basics (which look daunting at first but are really pretty simple), and then tackle each problem by breaking things down into small parts that are easier to solve on their own.

If you want to learn, my post RegExp basics: Removing characters from start/end of names should be a decent place to start.

By the way, the regexps I gave before look a lot more complicated than usual because they have to deal with ( ) [ ] characters, which all have special meaning within regexps.

Thx a lot, there are so many features in Dir Opus, renaming files is just part of it and yet powerful. Could be in next version make the renaming step more than 1 so that no need to repeat different renaming action for the same files.
It is wierd that this software is not widely known, at least i only came to know after intensive search on net on Windows Explorer replacement.
I can't remember why i decided on Dir Opus lol because the price is higher than the rest, but i am happy using it.

Hi,

It doesn't works if the filename starts with the brackets.

Ex: Filename = "[Test] File.txt"

It won't remove the [Test]. It will remove it only if this is not the 1st character. Can you tell me what to modify in the RegExp to also remove the brackets when it starts with it.

Regards

Old name: (.*)(^| )(\([^)]*\)|\[[^\]]*\]|^ )(.*)#
New name: \1\4
Type: Regular expressions


1 Like

Thanks. I find this very useful, too. Especially when downloading files from various services which add some unnecessary information to downloaded files names.

How come none of the above works in Dopus 12... ?

Because the new forum messed up the old posts. I've corrected them.

Thanks for prompt solution, it is working great now.