# Appending Length Field to Filename

**URL:** https://community.mp3tag.de/t/appending-length-field-to-filename/7010
**Category:** General Discussion
**Created:** [July 6, 2008, 7:27pm UTC](https://community.mp3tag.de/t/appending-length-field-to-filename/7010 "2008-07-06T19:27:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [July 6, 2008, 7:27pm UTC](https://community.mp3tag.de/t/appending-length-field-to-filename/7010/1 "2008-07-06T19:27:03Z")

</div>

Hi

I'm trying to append the Length of a track to the end of the file name in minutes and seconds.

I am creating a Format Value action with the field \_FILENAME and the Format string  
%\_filename% (%\_length%)

This does the job , but mysteriously removes the colon separator which is between the minutes and seconds in the Length field. I don't know why this should be. This squashes the minutes and seconds together , making it useless. Can anyone help , as i can't seem to fix it?

Instead of Filename (Mins:Secs) , I getting Filename (Minssecs).

Any ideas?

Grateful for any help.

Thanks.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [July 6, 2008, 8:05pm UTC](https://community.mp3tag.de/t/appending-length-field-to-filename/7010/2 "2008-07-06T20:05:06Z")

</div>

The colon is not allowed to be used inside of filenames.

To fix this, you can use the $replace function: %\_filename% ($replace(%\_length%,:,-))

---

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [July 7, 2008, 11:42pm UTC](https://community.mp3tag.de/t/appending-length-field-to-filename/7010/3 "2008-07-07T23:42:47Z")

</div>

Hi Florian

Ok thanks for that. I'm grateful for your help.

I built it into an Action , and it's working perfectly first time..

Thanks. much appreciated.

😃

---

<div class="post-metadata">

### Author: ![lonelon2000](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/e99b99/32.png) [@lonelon2000](https://community.mp3tag.de/u/lonelon2000)
#### Post date: [November 8, 2008, 11:46pm UTC](https://community.mp3tag.de/t/appending-length-field-to-filename/7010/4 "2008-11-08T23:46:15Z")

</div>

I know that this is an old topic, but here is some scripting that might make the display of the song length in a filename a little more palatable.

I use the following script to display the length of the song as m.ss if less than 10 minutes, and as mm.ss otherwise.

```
$if($less(%_length_seconds%,600),$mid(%_length%,2),$mid(%_length%,1,2)).$mid(%_length%,4,2)

```

00\_42 will show as 0.42  
05\_05 will show as 5.05  
13\_21 will show as 13.21

This seems to work pretty well for me as a part of my **Tag - Filename** conversions, this helped to replace an additional **Filename - Filename** conversion that I ran to change the %\_length% delimiter to a period and remove the leading zero for songs that were less than 10 minutes. Otherwise, I would just manually change the underscore for songs greater than 10 minutes.

---

<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: [August 7, 2025, 2:46pm UTC](https://community.mp3tag.de/t/appending-length-field-to-filename/7010/5 "2025-08-07T14:46:08Z")

</div>

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