How to rename these files?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

How to rename these files?

Post by zBernie »

I've tried using RegEx and batch renaming but am not getting the desired results. How can I rename files like this example:

File One (Remove parenthesis and text here).txt
File Two (Remove parenthesis and text here).txt
File Three (Remove parenthesis and text here).txt

to

File One.txt
File Two.txt
File Three.txt


-Thanks

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to rename these files?

Post by highend »

^(.*?)([ ]+\(.+?\))(\.[^.]+)$ > $1$3
One of my scripts helped you out? Please donate via Paypal

zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

Re: How to rename these files?

Post by zBernie »

highend wrote: ↑18 Feb 2022 13:20
^(.*?)([ ]+\(.+?\))(\.[^.]+)$ > $1$3
Thank you, but I screwed up the examples. They have another set of parenthesis in them like:

File Name One (1998) - AAAAA - The Good Son (Get rid of this).txt
File Name Two (1998) - BBBBB - Blah Blah Blah (Get rid of this).txt

TO

File Name One (2000) - AAAAA - The Good Son.txt
File Name Two (1998) - BBBBB - Blah Blah Blah.txt

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to rename these files?

Post by highend »

And you can't do that single change to the pattern itself?

^(.*?)([ ]+\([^(]+?\))(\.[^.]+)$ > $1$3
One of my scripts helped you out? Please donate via Paypal

zBernie
Posts: 181
Joined: 08 Dec 2016 17:20

Re: How to rename these files?

Post by zBernie »

highend wrote: ↑18 Feb 2022 13:37 And you can't do that single change to the pattern itself?

^(.*?)([ ]+\([^(]+?\))(\.[^.]+)$ > $1$3
Thanks.

Post Reply