# Tag to Filename Help (extended functions?)

**URL:** https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615
**Category:** General Discussion
**Created:** [January 15, 2017, 6:57pm UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615 "2017-01-15T18:57:51Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![turnedup5922](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@turnedup5922](https://community.mp3tag.de/u/turnedup5922)
#### Post date: [January 15, 2017, 6:57pm UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/1 "2017-01-15T18:57:51Z")

</div>

I've begun recently working with a lot of the old audio files I have, particularly audio books.

They're really not sorted very well.

The problem is the folder their in has no stable naming convention - sometimes author, sometimes book sometimes author-book-series and any number of combinations, not even formatting them the same (particularly the series). I'm cleaning everything up a little at a time, but what I'd like to do is create a naming convention that allows me to use Author - series - Title and cuts off the extra parts.

The title is the problem. I have a lot of audio books that are formatted with a title of the book and then something like the following:  
Book Title 01  
Book Title CD 01  
Book Title Part 01  
Book Title Disc 01 Part 01  
Book Title Chapter 01

If I could just cut it off at the start of the numbering sequence, that would generally suffice, but if there's a better way to cut off at a list of specific words, that would be even better. (IE  
" CD " " Part " " Disc " " Chapter "

Right now I have to go through and edit the folder manually, and it's taking a lot of time and there's a lot more to do.

If I could cut off at the numbering sequence, I could use a separate program (a renaming program) to clear out certain keywords, and it would generally leave the collection in the same folder, so I wouldn't have to move things much.

I'm certain there's away to do it, using the function field, but I have no idea what it would be. I've searched, but either I'm not searching for the right keywords or it's not in the forum (or easily finable through google).

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 16, 2017, 5:20am UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/2 "2017-01-16T05:20:52Z")

</div>

> [@TunedUp](#):
>
> something like the following...  
> Book Title 01  
> Book Title CD 01  
> Book Title Part 01  
> Book Title Disc 01 Part 01  
> Book Title Chapter 01  
> ...

As you see, language is not logical.  
So I would filter for various occurrances with a filter like:  
%album% MATCHES "CD \d+$"

And then I would apply an action of the type "Format value" for \_DIRECTORY  
Format string: $regexp(%album%,(.\*) CD \d+$,$1)

Repeat that for Part 01, Disc 01, Chapter 01.

The trick with  
Format string: $regexp(%album%,(.\*) \w+ \d+$,$1)  
will not work due to the first example Book Title 01

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [January 16, 2017, 5:23am UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/3 "2017-01-16T05:23:51Z")

</div>

It does not get clear of what renaming you are talking about.  
Do you want to rename the filename or do you talk about renaming the title-tag or other tags?

The recommended workflow for Mp3Tag is first to get the tags right.  
A renaming og the filename with the help of the tags then is very easy.

So have you filled your tags at all?

---

<div class="post-metadata">

### Author: ![turnedup5922](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@turnedup5922](https://community.mp3tag.de/u/turnedup5922)
#### Post date: [January 16, 2017, 6:59pm UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/4 "2017-01-16T18:59:38Z")

</div>

Sorry, I want to rename the folders using tag to filename

%artist% - %album% - %title%\%title%

Artist - Album - Title  
Artist is author,  
Album is used with book series  
Title is book Title (and) the numbering scheme, because of how my MP3 reader reads stuff, it makes it easy to see where I am and keep it easier to organize, otherwise I'd use track, and not have this mess.

My title is the problem, When I have something that says:  
Book Name CD 01  
Book Name CD 02

I get separate folders for each title. I'm trying to make it so everything all goes into a single folder, with minimal renaming. If there is a specific function that basically cuts anything off at a number sequence, that would work decently and it would help a lot, cutting down the time I spend renaming. Or to be able to cut off at keywords (CD, Disc, Track, Chapter...)

So I want something like:  
%artist% - %album% - %title%(abridged to remove anything up to numbering or keywords)\%title%  
Example  
With the title(s)  
Tarzan of the Apes Chapter 01  
Tarzan of the Apes Chapter 02 ...

Turn the folder into:  
Edgar Rice Burroughs - Tarzan 01 - Tarzan of the Apes Chapter\Tarzan of the Apes Chapter 01.mp3  
Edgar Rice Burroughs - Tarzan 01 - Tarzan of the Apes Chapter\Tarzan of the Apes Chapter 02.mp3 ...

All the same folder. I can easily use an action or a renamer Chapter/CD/Disc whatever, or use an action possibly, as has been pointed out.

Is that clear enough? I am sorry, I never really do well at explaining myself with text.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 16, 2017, 7:34pm UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/5 "2017-01-16T19:34:14Z")

</div>

And coming back to poster poster's question:

> [@](#):
>
> So have you filled your tags at all?

---

<div class="post-metadata">

### Author: ![turnedup5922](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@turnedup5922](https://community.mp3tag.de/u/turnedup5922)
#### Post date: [January 17, 2017, 12:38am UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/6 "2017-01-17T00:38:17Z")

</div>

> [@ohrenkino](#):
>
> And coming back to poster poster's question:

Sorry, didn't see that last line.  
Yes, I've been working through them and have more than half filled in - the variety of tag is the reason I'm asking the question.

But one way or another if all the tags said the same thing IE  
With the title(s)  
Tarzan of the Apes 01  
Tarzan of the Apes 02 ...

I still run into the same problem. I need the title to reflect the number, even if CD/Disc/Chapter ist stripped out, because there is too much of a variety on how the books are broken down. Sometimes by CD then track, sometimes just a number... I really need something to just filter that number (and everything after it) out when making the folders.

I know there will be some odd exceptions (books with numbers in the title) but overall this will save me many hours of work, having to go in and rename every single audio book I've worked the tags with. I did a portion already and it took a really long time.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 17, 2017, 5:07am UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/7 "2017-01-17T05:07:58Z")

</div>

Try an action of the type "Format value" for \_DIRECTORY  
Format string: %artist% - %album% - $regexp(%title%, \d+,)

---

<div class="post-metadata">

### Author: ![turnedup5922](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/f9ae1b/32.png) [@turnedup5922](https://community.mp3tag.de/u/turnedup5922)
#### Post date: [January 17, 2017, 6:00pm UTC](https://community.mp3tag.de/t/tag-to-filename-help-extended-functions/18615/8 "2017-01-17T18:00:07Z")

</div>

That... Seems to work! Thanks! This'll save me a lot of time. I wish I hadn't spent the hours I did doing the previous directory renaming before coming here and asking.

I used this, and made some additional regex actions to remove trailing words  
\sPart$  
\sCD$  
... and it all turns out great. I was going to try working more with your original suggestion to see if I could get something simpler, but this was a much cleaner option and I can have a single action take care of everything with those remove ending expressions.
