# Format Directory than Format Filename

**URL:** https://community.mp3tag.de/t/format-directory-than-format-filename/19633
**Category:** Support
**Created:** [December 26, 2017, 7:50pm UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633 "2017-12-26T19:50:54Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [December 26, 2017, 7:50pm UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/1 "2017-12-26T19:50:54Z")

</div>

Using format directory to move files to new location, than trying to create Disc Folders using format filename in the newly created directory location however:

Format Directory - moves folder to new location  
Format Filename - generates Disc folders but pulls files back to original location to do so?

Why is that and how can I achieve my end result without having to pull the new directory folder into MP3tag and than run the format filename?

---

<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: [December 26, 2017, 8:01pm UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/2 "2017-12-26T20:01:28Z")

</div>

see [Moving all files (including non mp3) and rename if required](https://community.mp3tag.de/t/19511/8)

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [December 26, 2017, 10:59pm UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/3 "2017-12-26T22:59:26Z")

</div>

I did try absolute paths as well as some options suggested by Dano/Damage after searching the previous entries in the forums dating all the way back to the beginning...no love there either.

Like this one from 2010:  
Format Value  
Field: \_FILENAME  
Format string: %\_folderpath%$if($geql(%discnumber%,1),CD $num(%discnumber%,1),)%\_filename%

however this one created folders with the complete folderpath which is not what I was after...

Was hoping to get some new insight by asking again...

---

<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: [December 27, 2017, 7:41am UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/4 "2017-12-27T07:41:08Z")

</div>

> [@MyAlteredEgo](#):
>
> ....  
> however this one created folders with the complete folderpath which is not what I was after...
> 
> Was hoping to get some new insight by asking again...

I think that it is still true that actions to rename files or folders are always executed last in a row of actions.  
So, the simplest way would be to start the action for folders apart from the one for filenames.  
But you already got that advice.

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [December 28, 2017, 3:07am UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/5 "2017-12-28T03:07:07Z")

</div>

> [@ohrenkino](#):
>
> I think that it is still true that actions to rename files or folders are always executed last in a row of actions.  
> So, the simplest way would be to start the action for folders apart from the one for filenames.  
> But you already got that advice.

You sound almost annoyed that I am looking for alternate ideas?

A fresh pair of eyes or ideas doesn't hurt...

I spent considerable time working on this via knowledge and forum queries:  
See Compilation Volume...

 ![](https://community.mp3tag.de/uploads/default/original/2X/5/5e96c814a027dcf1fc4c60529c4e53aaf22ab6d7.PNG)  
  
Than someone suggested something to someone else in the forums and I was able to basically boil it all down to:  
See Forum Suggestion Compilation...  
 ![](https://community.mp3tag.de/uploads/default/original/2X/7/7bee65d7418dcead365af80423da79f55b67407b.PNG)  

obviously much cleaner and easier...

I am just looking at options and/or a different perspective...Apologies if you seem put out by this as that was not my intent as you are a wealth of insight.

 ![](https://community.mp3tag.de/uploads/default/original/2X/5/5e96c814a027dcf1fc4c60529c4e53aaf22ab6d7.PNG)  

 ![](https://community.mp3tag.de/uploads/default/original/2X/7/7bee65d7418dcead365af80423da79f55b67407b.PNG)

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [December 28, 2017, 9:10am UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/6 "2017-12-28T09:10:59Z")

</div>

> [@MyAlteredEgo](#):
>
> ... I am looking for alternate ideas ...

You have attached a picture, which shows this format string ...

$mid(%album%, (Hands|Festival|Sampler|Compilation|Volume),999)

This looks as an improper usage of the function $mid(string,startposition,length).

Within this regular expression ...

$regexp(%album%,'^.\* (Volume \D+).\*$','$1')

... there is applied the placeholder \D, ... which specifies a non-digit-value, ...  
is this intended?

To move a file to a new location and define folders, you may apply such a formatstring ...  
Action: Format Value ... on field: \_FILENAME ...  
Formatstring:

'M:\MUSIC\_NEW\'$upper($left($if2(%ALBUMARTIST%,%ARTIST%),1))'\'$if2(%ALBUMARTIST%,%ARTIST%)'\'[$left(%YEAR%,4)' - ']$if2(%ALBUM%,'Unknown')'\'%\_filename%

DD.20171228.1159.CET

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [December 28, 2017, 9:50pm UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/7 "2017-12-28T21:50:38Z")

</div>

> [@DetlevD](#):
>
> You have attached a picture, which shows this format string ...
> 
> $mid(%album%, (Hands|Festival|Sampler|Compilation|Volume),999)
> 
> This looks as an improper usage of the function $mid(string,startposition,length).

So basically I have bastardized this function however it does exactly what I need it to do and I do not require one function for each item (Hands|Festival|Sampler|Compilation|Volume|Part)..however as it does work I think that I will not be trying to correct my error...

Guess sometimes the easiest way to do something is by accident...

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [December 29, 2017, 10:19am UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/8 "2017-12-29T10:19:48Z")

</div>

> [@MyAlteredEgo](#):
>
> So basically I have bastardized this function ...

Yes, you did some sort of fake here.

> [@MyAlteredEgo](#):
>
> ... however it does exactly what I need it to do ...

Ok, each one according to his personal form ... put some botch in .. and it gives botch out.

> [@MyAlteredEgo](#):
>
> ... however as it does work I think that I will not be trying to correct my error.

I am still of the opinion that you gave us a totally improper example of applying the Mp3tag Scripting language.

DD.20171229.1219.CET

---

<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: [December 29, 2017, 1:40pm UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/9 "2017-12-29T13:40:57Z")

</div>

> [@DetlevD](#):
>
> I am still of the opinion that you gave us a totally improper example of applying the Mp3tag Scripting language.
> 
> DD.20171229.1219.CET

I completely agree: I tried it with  
$mid(%album%, (Diary|Festival|Sampler|Compilation|Volume),999)  
for an Album called "Ambient.Diary One"  
and it returns nothing.

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [December 30, 2017, 2:08am UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/10 "2017-12-30T02:08:53Z")

</div>

> [@ohrenkino](#):
>
> I completely agree: I tried it with  
> $mid(%album%, (Diary|Festival|Sampler|Compilation|Volume),999)  
> for an Album called "Ambient.Diary One"  
> and it returns nothing.

It would seem that I owe you both an apology. I went back and took another look at the action itself and ran it singularly ....and you both are 100% correct, this actually does nothing at all....  
When I entered this I added it to a UTILS action grouping that had an action that already populated the guess value fields...so I mistook this as the action that did it...my sincerest apologies

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:27pm UTC](https://community.mp3tag.de/t/format-directory-than-format-filename/19633/11 "2026-02-09T12:27:09Z")

</div>


