# Changing filename according to extension

**URL:** <https://community.mp3tag.de/t/changing-filename-according-to-extension/52583>\
**Category:** Support\
**Created:** [March 28, 2021, 6:21pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583 "2021-03-28T18:21:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 6:21pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/1 "2021-03-28T18:21:21Z")

</div>

how do i change filenames differently depending on extension?

suppose i have mp3 and opus files together

i want to change the file name of the mp3 files to  
E:\Music\Mp3%albumartist%%album%%albumartist% - %title%

and the opus files to  
E:\Music\Opus%albumartist%%album%%albumartist% - %title%

is it possible without using filters?

---

<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:** [March 28, 2021, 6:24pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/2 "2021-03-28T18:24:13Z")

</div>

Change

> [@royden](#):
>
> E:\Music\Mp3%albumartist%%album%%albumartist% - %title%

and

> [@royden](#):
>
> E:\Music\Opus%albumartist%%album%%albumartist% - %title%

to  
`E:\Music\%extension%\%albumartist%\%album%\%albumartist% - %title%`

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 6:29pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/3 "2021-03-28T18:29:26Z")

</div>

thanks!

but what if i want to put the mp3 files in a folder called just E:\Music ?

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 6:32pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/4 "2021-03-28T18:32:12Z")

</div>

let me rephrase this. i shouldve asked this in the beginning

i want to move mp3 files into E:\Music%albumartist%%album%%albumartist% - %title%

and my opus files into E:\Songs\Opus%albumartist%%album%%albumartist% - %title%

how do i do it all at once? sorry for any confusion

---

<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:** [March 28, 2021, 6:35pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/5 "2021-03-28T18:35:58Z")

</div>

`$replace($lower(%extension%),opus,E:\Songs\Opus,mp3,E:\Music)\%albumartist%\%album%\%albumartist% - %title%`

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 6:40pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/6 "2021-03-28T18:40:58Z")

</div>

> [@ohrenkino](#):
>
> $replace($lower(%extension%),opus,E:\Songs\Opus,mp3,E:\Music)%albumartist%%album%%albumartist% - %title%

for some reason it didnt work : (

---

<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:** [March 28, 2021, 6:43pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/7 "2021-03-28T18:43:06Z")

</div>

Did you check the preview for each file type? (It worked over here ...)

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 6:45pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/8 "2021-03-28T18:45:21Z")

</div>

do i have to input this into Convert \> Tag - Filename  
or should i use Format Value - \_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:** [March 28, 2021, 6:46pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/9 "2021-03-28T18:46:32Z")

</div>

That should be the same, really.  
But the Converter shows you a preview first. When you are sure that you have the right expression, then you can use the format value action.

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 6:48pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/10 "2021-03-28T18:48:56Z")

</div>

> [@ohrenkino](#):
>
> $replace($lower(%extension%),opus,E:\Songs\Opus,mp3,E:\Music)%albumartist%%album%%albumartist% - %title%

the preview says the file already exists for some reason

The file "E:\TEST\Eternal Grey$uicideBoy$\Eternal Grey$uicideBoy$ - BREAKDALAW2K16 (feat. Pouya).mp3" already exists.  
File "E:\TEST\Eternal Grey$uicideBoy$\Eternal Grey$uicideBoy$ - BREAKDALAW2K16 (feat. Pouya).mp3" has not been renamed.

when i input into convert \> tag - 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:** [March 28, 2021, 6:51pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/11 "2021-03-28T18:51:42Z")

</div>

I don't know how you end up in a folder called e:\test when the leading part of the filename gets set to e:\music  
Could you show me a screendump of what you enter?

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 6:52pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/12 "2021-03-28T18:52:52Z")

</div>

i made a folder called E:\Royden\TEST to test this out

for the files in there i enter  
$replace($lower(%extension%),opus,E:\Royden\Songs\Songs - Opus,mp3,E:\Royden\Music)%albumartist%%album%%albumartist% - %title%

---

<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:** [March 28, 2021, 6:57pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/13 "2021-03-28T18:57:45Z")

</div>

This, again, does not match what you wrote previously,  
First it is

> [@royden](#):
>
> E:\TEST

now it is

> [@royden](#):
>
> E:\Royden\Songs\Songs - Opus

So, I think a screendump of the real application of the format string would be helpful in the Converter as that shows the preview.

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 7:00pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/14 "2021-03-28T19:00:37Z")

</div>

sorry for making things confusing. would you like a screenshot of the convert window?

---

<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:** [March 28, 2021, 7:01pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/15 "2021-03-28T19:01:43Z")

</div>

yes, please.  
What I cannot rectify: renaming a file to a filename that already exists will always lead to an error that this could not be done.

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 7:04pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/16 "2021-03-28T19:04:38Z")

</div>

![image](https://community.mp3tag.de/uploads/default/original/2X/5/5b06ad0677c62c2a8e8d7670a46b5689aca23f47.png)

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 28, 2021, 7:05pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/17 "2021-03-28T19:05:43Z")

</div>

can i get back to you tomorrow? it is getting late for me. thanks for helping me today

---

<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:** [March 28, 2021, 7:20pm UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/18 "2021-03-28T19:20:25Z")

</div>

Sorry, I had the wrong variable name: this should work:  
`$replace($lower(%_extension%),opus,E:\Songs\Opus,mp3,E:\Music)\%albumartist%\%album%\%albumartist% - %title%`

---

<div class="post-metadata">

**Author:** ![royden](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@royden](https://community.mp3tag.de/u/royden)\
**Post date:** [March 29, 2021, 6:22am UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/19 "2021-03-29T06:22:52Z")

</div>

> [@ohrenkino](#):
>
> $replace($lower(%\_extension%),opus,E:\Songs\Opus,mp3,E:\Music)%albumartist%%album%%albumartist% - %title%

bro thank you so much for taking your time and bearing with me to answer my question. it worked. thanks a lot!

---

<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:** [April 28, 2021, 6:23am UTC](https://community.mp3tag.de/t/changing-filename-according-to-extension/52583/20 "2021-04-28T06:23:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
