#1 Yesterday 01:30

Digidoc
Member
Registered: Yesterday
Posts: 3

Renaming ebook files

Greets and hello. I have many thousands of ebooks which need to be renamed. They are actually in this format:

A Change in Altitude - Anita Shreve.mobi
A Wedding in December_ A Novel - Anita Shreve.mobi
Fortune's rocks_ a novel - Anita Shreve.mobi
Gentlemen prefer blondes - Anita Loos.mobi
The Red Tent - Anita Diamant.mobi

Or: Title - Author First, {sometimes initials} Author Last.

I want to rename to this:

Shreve, Anita-A Change In Altitude.mobi
Shreve, Anita-A Wedding In December_A Novel.mobi
Shreve, Anita-Fortune's Rocks_A Novel.mobi
Loos, Anita-Gentlemen Prefer Blondes.mobi
Diamant, Anita-The Red Tent.mobi

Or: Author Last, Author First-Title.
----------------
I can capitalize each word.
I can change [ - ] to a single [-]
I can replace [_ ] to a single [-]
Is it possible to analyze the title, and rearrange as I have suggested? I have another 14,000 books to rename, so even if I can manage 1000 per month, this will take me a --very-- long time. Thoughts? Suggestions? (email is always welcome)

Perhaps each space in the original name could be a split point?
These split points could then be assigned numbers?
The name could then be arranged to put the last split first, followed by a comma, the second to last split point, followed by a [-] and then the remainder of the split points?

Last edited by Digidoc (Yesterday 02:25)

Offline

#2 Yesterday 17:54

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,520

Re: Renaming ebook files

You'll need the power of the Regular Expressions rule for this one.

Replace expression "^(.*)\s+-\s+(\S+)\s+(\S+)$" with "$3, $2-$1" (skip extension).

Note that this pattern assumes that the author name consists of exactly two words, no more, no less.

Offline

#3 Yesterday 19:00

eR@SeR
Senior Member
Registered: 2008-01-23
Posts: 359

Re: Renaming ebook files

Hello,

This RegEx rule include cases if there are 2, 3 or more words (initials as well) in author's name:

Replace expression "(.+) - ([^\s]+) (.+)" with "$3, $2-$1" (skip extension)

From:

A Change in Altitude - Anita Shreve.mobi
A Wedding in December_ A Novel - Anita Shreve.mobi
Fortune's rocks_ a novel - Anita Shreve.mobi
Gentlemen prefer blondes - Anita Loos.mobi
The Red Tent - Anita Diamant.mobi
The Hobbit and The Lord of the Rings - J.R.R. Tolkien.mobi
Extinction - Douglas J. Preston.mobi
One Hundred Years of Solitude - Gabriel García Márquez.mobi
Game of Thrones - George Raymond Richard Martin

To:

Shreve, Anita-A Change in Altitude.mobi
Shreve, Anita-A Wedding in December_ A Novel.mobi
Shreve, Anita-Fortune's rocks_ a novel.mobi
Loos, Anita-Gentlemen prefer blondes.mobi
Diamant, Anita-The Red Tent.mobi
Tolkien, J.R.R.-The Hobbit and The Lord of the Rings.mobi
J. Preston, Douglas-Extinction.mobi
García Márquez, Gabriel-One Hundred Years of Solitude.mobi
Raymond Richard Martin, George-Game of Thrones

Addition: If you want to have Author Last, Author First {sometimes 2+ words, initials} as a result use:

Replace expression "(.+) - (.+) (.+)" with "$3, $2-$1" (skip extension)

Offline

Board footer

Powered by FluxBB