Change from Title - Author.ext to Author - Title.ext

I have been working to clean up some of my ebook files. Most are in the format:

Author - Title.ext

However, some are in the format:

Title - Author.ext

I'd like to create a quick rename script (that I can attach to a button on my toolbar) to swap the author and title portions of the filename. Any suggestions?

And to add a bit of complexity, sometimes the author is listed Firstname Lastname while other times it is Lastname, Firstname. Though I actually prefer the Lastname, Firstname schema, the vast majority of the books are Firstname Lastname. Thus, to be consistent, I usually make that change as well. Thus, a script (standalone would probably work better) that could take:

Lastname, Firstname - Title.ext

and change it to

Firstname Lastname - Title.ext

would also be very useful.

Thanks in advance for any help or suggestions.

Here are a couple advanced rename dialog presets you could create to do this.

I made these pretty quickly and haven't really tested them out to make sure they'll do exactly what you want, but it should give you a starting point.

Thanks, John. I'll try these RE and let you know if I have any problems. I appreciate the help (for some reason, I'm still having a hard time wrapping my brain around how to use RE).

OK. Silly question #1: How do I assign either of these renaming schemes to a button?

And Silly question #2: On the first rename dialog (to switch from Last, First - Title to First Last - Title), the RE adds a space before the Firstname in the renamed file. How do I edit the RE to eliminate this extra space?

Thanks again for the help.

Go into customize mode, create a new button, then add the preset argument to it along with the name of the script preset you want to use. (See screen shot below).

Oops, you're right. However the fix is easy to make. Simply insert a space right after the comma in the following line:

(.*),(.*) - (.*)\.(.*)

Screen shot follows.

Awesome. That will save me a lot of time. Thanks.