Only use part of a tag to populate filename

Hello All,

First off let me apologize. I am 90% sure this question has been answered, and I am just having the hardest time finding that thread or I am not searching properly. If you can lead me in the right direction would be appreciated.

What I am trying to accomplish is to use the Album tag, to complete the filename (_FILENAME). But I only want the last part of the Album tag.

For example...

Album:
The Iron Druid Chronicles, Book 01 - Hounded

Filename:
Book 01, Hounded - Chapter ##
(note that I am also converting the dash to a comma as well)

I am using the Convert > Tag - Filename options currently and I am manually completing the first part and just adding the " - Chapter $num(%track%,2)" on the end. But I would like to try and have this actioned so its just a button click job.

Thank you for your time and assistance!

So after some digging and cobbling some code together, I have come up with this...

Format Value
Field: _FILENAME
Format string:
$trimLeft($replace($regexp(%album%,'.*,',), -,',')) - Chapter $num(%track%,2)

This appears to work pretty good. First off, does anyone have any comments or suggestions that would improve this, or have reason to believe that this will give me problems in certain situations?

I had to add the %trimLeft to the expression because I was getting a space in the front of the filename. I am not sure how that was being generated. Perhaps you might have some thoughts on that too?

EDIT:
I found the space issue that required the $trimLeft. The space after my comma needed accounted for.

Thanks all.

5 posts were split to a new topic: Only use part of the filename to import in tag field