Removing words between [ ] from file names

Bulk Rename Utility How-To's

Removing words between [ ] from file names

Postby subongo » Sun Jun 27, 2021 5:55 pm

Hi
How do I go from a title that looks like this:- How To Hold Your Drumsticks Correctly - Drum Lesson [EePm3QsqnOM]
to this:- How To Hold Your Drumsticks Correctly - Drum Lesson

I am simply trying to remove any thing between the square brackets in multiple files.
subongo
 
Posts: 8
Joined: Thu Jan 25, 2018 6:56 pm

Re: Removing meaningless words from file names

Postby Luuk » Mon Jun 28, 2021 4:52 am

For the example, you can use RegEx(1) with a checkmark in "Simple", and a Match and Replace like...
%1 [%2]
%1
Luuk
 
Posts: 325
Joined: Fri Feb 21, 2020 10:58 pm

Re: Removing words between [ ] from file names

Postby subongo » Mon Jun 28, 2021 10:37 pm

:D Many thanks Luuk. I do not understand the logic of how it works but it works and has saved me tons of time :D
subongo
 
Posts: 8
Joined: Thu Jan 25, 2018 6:56 pm

Re: Removing words between [ ] from file names

Postby Luuk » Tue Jun 29, 2021 2:51 am

It removes the first-occurence of " [word]" and everything after, so be careful with it! For your example its no trouble, but names like...
aaa [bb] ccc ddd.txt ===> aaa.txt
111 [22] 33 [44].txt ===> 111.txt

If only wanting to remove [word] at the very end, remove the checkmark from 'Simple' using a Match and Replace like...
(.+[^ ]) +\[[^]]*\]$
\1

Or if wanting to remove all " [words]" and keep everything else, you can put a checkmark in "v2" using only a Match like...
\ \[[^]]*\]/g
Luuk
 
Posts: 325
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To