# Output to filename %\_length%

**URL:** <https://community.mp3tag.de/t/output-to-filename-length/15520>\
**Category:** Support\
**Created:** [February 19, 2014, 7:29pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520 "2014-02-19T19:29:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![frazld](https://community.mp3tag.de/user_avatar/community.mp3tag.de/frazld/32/21923_2.png) [@frazld](https://community.mp3tag.de/u/frazld)\
**Post date:** [February 19, 2014, 7:29pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/1 "2014-02-19T19:29:33Z")

</div>

The output at the tag columns for %\_length% is minutes and seconds  
separated by a : colon example 2:49.  
When transferring %\_length% to be included in the file name the colon :  
converted to an underscore \_ 2\_49. Is there a way to change the underscore \_  
to nothing and have the output as 249?  
Or is there a way to delete the last occurrence of the underscore \_ in the file name?

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [February 19, 2014, 7:45pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/2 "2014-02-19T19:45:03Z")

</div>

Use the ![:mt_ttf:](https://community.mp3tag.de/uploads/default/original/1X/922db76db5d45b2e558d10f3d8c25fb8bc04fd27.png ":mt\_ttf:") (Tag - Filename) with $regexp($regexp(%_length%,'_',.),^0+,)mins \>\>place other field/s here or before $replace\<\<

Will show up as 3.49mins. Just remove the optional things marked red if needs be.

---

<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:** [February 19, 2014, 7:50pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/3 "2014-02-19T19:50:17Z")

</div>

> [@frazld](#):
>
> The output at the tag columns for %\_length% is minutes and seconds separated by a : colon example 2:49.  
> When transferring %\_length% to be included in the file name the colon :  
> converted to an underscore \_ 2\_49.

That is correct, because the colon is a reserved character in the filesystem.  
You can use the function **$validate** to define your own replacement character.

If you do not want to replace the default underline character at all, then you may use the function **$replace** to modify only the output of the %\_length% system variable, ...  
for example ...

**$replace(%\_length%,':',)==\> 0437 $replace(%\_length%,':','m')==\> 04m37 $replace(%\_length%,':','m')'s'==\> 04m37s '['$replace(%\_length%,':','m')'s]'==\> [04m37s] $replace('('%\_length%'s)',':','m')==\> (04m37s)**

DD.20140219.2152.CET  
DD.20140220.1500.CET

---

<div class="post-metadata">

**Author:** ![frazld](https://community.mp3tag.de/user_avatar/community.mp3tag.de/frazld/32/21923_2.png) [@frazld](https://community.mp3tag.de/u/frazld)\
**Post date:** [February 19, 2014, 7:53pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/4 "2014-02-19T19:53:24Z")

</div>

> [@stevehero](#):
>
> Use the ![:mt_ttf:](https://community.mp3tag.de/uploads/default/original/1X/922db76db5d45b2e558d10f3d8c25fb8bc04fd27.png ":mt\_ttf:") (Tag - Filename) with $replace($regexp(%_length%,'_',.),0,)mins \>\>place other field/s here or before $replace\<\<
> 
> Will show up as 3.49mins. just removes the mins if needs be.

Sorry I should have included all I was doing. I have included it inside of one column called Bitrate  
with the below expression and I believe that I can only use 1 replace function. But I could be wrong.

%\_bitrate% $left(%\_vbr%,1) $replace(%\_mode%,Joint Stereo,JS,Stereo,S,Single Channel,M,Dual Channel,D) %\_length%

---

<div class="post-metadata">

**Author:** ![frazld](https://community.mp3tag.de/user_avatar/community.mp3tag.de/frazld/32/21923_2.png) [@frazld](https://community.mp3tag.de/u/frazld)\
**Post date:** [February 19, 2014, 8:05pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/5 "2014-02-19T20:05:17Z")

</div>

> [@frazld](#):
>
> Sorry I should have included all I was doing. I have included it inside of one column called Bitrate  
> with the below expression and I believe that I can only use 1 replace function. But I could be wrong.
> 
> %\_bitrate% $left(%\_vbr%,1) $replace(%\_mode%,Joint Stereo,JS,Stereo,S,Single Channel,M,Dual Channel,D) %\_length%

After thinking about this I really don't need this in the file name and if I change my mind I can just delete the last occurrence of the \_ anyway. And I can see this info in mp3tag and probably set foobar to see it also.

BTW I can not believe the lack of knowledge that people have on tagging their music lots of time they just dump all the info into comments, notes, description or even in the title area. Its driving me nutty.

---

<div class="post-metadata">

**Author:** ![frazld](https://community.mp3tag.de/user_avatar/community.mp3tag.de/frazld/32/21923_2.png) [@frazld](https://community.mp3tag.de/u/frazld)\
**Post date:** [February 19, 2014, 8:06pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/6 "2014-02-19T20:06:00Z")

</div>

Thank You for all of your help

---

<div class="post-metadata">

**Author:** ![LumenMundi](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/ecb155/32.png) [@LumenMundi](https://community.mp3tag.de/u/LumenMundi)\
**Post date:** [February 20, 2014, 12:19pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/7 "2014-02-20T12:19:28Z")

</div>

Hello,

Maybe this helps:

To add the length and the Bitrate to my filenames I created the following action:

**FormatValue**  
Field:  
\_Filename

Format string:  
%artist% - %title% '['$left(%\_length%,$sub($len(%\_length%),2))m$right(%\_length%,2)s']' '['%\_bitrate%kBps']'

This results in a file name like:

ABBA - Thank you for the music [03m26s] [128kBps].mp3

---

<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:24pm UTC](https://community.mp3tag.de/t/output-to-filename-length/15520/8 "2026-02-09T12:24:55Z")

</div>

Closed on February 9, 2026, 12:24pm UTC


