Swap author name and title in ebook files

Bulk Rename Utility How-To's

Swap author name and title in ebook files

Postby bookhlp » Sun Aug 03, 2025 3:03 am

Hi, I've been using BRU for various things since finding it, but I have some files I want to rename in a way that I can't figure out how to do, and I haven't found any other posts with solutions which work.

I have a large amount of ebook files that are named "[Firstname Lastname] - [Title]" (without the apostrophes of course). Some of them are part of a series and so also have numbers and a period before them, eg "17. " or "01. "
The author names and titles vary, and I was looking for a way to mass change all of these files from the aforementioned naming scheme to "[Title] by [Firstname Lastname]", or change the ones with numbers and then change the ones without numbers. For example:

11. Franz Kafka - The Metamorphosis --> 11. The Metamorphosis by Franz Kafka
George Orwell - Animal Farm --> Animal Farm by George Orwell

Thanks a lot for any help!
bookhlp
 
Posts: 2
Joined: Sun Aug 03, 2025 2:47 am

Swap text on either side of " - "

Postby Luuk » Sun Aug 03, 2025 4:49 am

With Regex(1) the "Match" and "Replace" can be like...
^(?!.* - .* - .*)(\d{1,2}\. )?([^\d].+ .+) - (.+)
\1\3 by \2

The red-part is a lookahead, just to make sure there's only 1 " - " inside of the names.

01. NewYork Winter - Mainstr -------> 01. Mainstr by NewYork Winter
11. Franz Kafka - Metamorphosis ---> 11. Metamorphosis by Franz Kafka
George Orwell - Animal Farm --------> Animal Farm by George Orwell
George Orwell - Text1 - Text2 -------> (not renamed, too many " - " )
Luuk
 
Posts: 831
Joined: Fri Feb 21, 2020 10:58 pm

Re: Swap author name and title in ebook files

Postby bookhlp » Sun Aug 03, 2025 12:47 pm

Thank you, it works great :mrgreen:
bookhlp
 
Posts: 2
Joined: Sun Aug 03, 2025 2:47 am


Return to How-To