# How to easily rename file with track total?

**URL:** https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279
**Category:** Support
**Created:** [September 13, 2005, 5:21pm UTC](https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279 "2005-09-13T17:21:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Praxis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/a9a28c/32.png) [@Praxis](https://community.mp3tag.de/u/Praxis)
#### Post date: [September 13, 2005, 5:21pm UTC](https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279/1 "2005-09-13T17:21:09Z")

</div>

Hi folks, let me say again what a great tool MP3TAG is; too bad I'm a bit too dim to use all its features properly.

My question is:  
Can anyone suggest an easy way to rename files that automatically includes the total number of tracks in the filename?

Here's what I mean.  
I use the Autonumbering feature to give me a track field formatted like 001/144. Then I use the 'Tag-\>Filename' feature to give me a filename with the total number of tracks like this:

%artist% - %album% - $num(%track%,3) Of 144

This works fine, but I was wondering if there was a slightly more elegant way to do this than re-editing the 'Tag-\>Filename' formatstring with the total number of tracks from the second part of the %track% field.

Probably not, and it (obviously) isn't very important, but there seem to be a number of very helpful power users at this forum and I figured I'd throw it out there.

Thanks very muchly (isn't there a song 'Die Gedanken Sind Frei'?)

---

<div class="post-metadata">

### Author: ![nickless](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nickless/32/36_2.png) [@nickless](https://community.mp3tag.de/u/nickless)
#### Post date: [September 13, 2005, 5:33pm UTC](https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279/2 "2005-09-13T17:33:01Z")

</div>

Hi Praxis!

> [@](#):
>
> %artist% - %album% - $num(%track%,3) Of 144

Use

```
%artist% - %album% - $left(%track%,$sub($strchr(%track%,/),1)) of $right(%track%,$sub($len(%track%),$strchr(%track%,/)))

```

instead (Track field should contain the total number of tracks)

Regards  
nickless

---

<div class="post-metadata">

### Author: ![Praxis](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/a9a28c/32.png) [@Praxis](https://community.mp3tag.de/u/Praxis)
#### Post date: [September 13, 2005, 8:44pm UTC](https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279/3 "2005-09-13T20:44:42Z")

</div>

> [@](#):
>
> Hi Praxis!
> 
> Use
> 
> ```
> %artist% - %album% - $left(%track%,$sub($strchr(%track%,/),1)) of $right(%track%,$sub($len(%track%),$strchr(%track%,/)))
> 
> ```
> 
> instead (Track field should contain the total number of tracks)
> 
> Regards  
> nickless
> 
> \<{POST\_SNAPBACK}\>

Thanks, Nickless, it works like a charm, even though it gives me a headache even trying to parse exactly what is happening. Some folks were just born to be clueless end users, I'm afraid. ![:wacko:](https://community.mp3tag.de/uploads/default/original/1X/455ecca54df2b24f3c99cde256604242b1031da2.gif ":wacko:")

---

<div class="post-metadata">

### Author: ![j0hnw](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/cab0a1/32.png) [@j0hnw](https://community.mp3tag.de/u/j0hnw)
#### Post date: [September 15, 2005, 12:55am UTC](https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279/4 "2005-09-15T00:55:36Z")

</div>

> [@](#):
>
> Thanks, Nickless, it works like a charm, even though it gives me a headache even trying to parse exactly what is happening. Some folks were just born to be clueless end users, I'm afraid. ![:wacko:](https://community.mp3tag.de/uploads/default/original/1X/455ecca54df2b24f3c99cde256604242b1031da2.gif ":wacko:")
> 
> \<{POST\_SNAPBACK}\>

And there's a simpler format string for use in the _special case_ where you're acting on **_all_** the files of the given album. That is, given your example, if you select all 144 files for "renaming", you could use the format string:

%artist% - %album% - $num(%track%,3) Of %\_total%

Note that %\_total% gives the total number of **selected** files.

Not as general purpose or robust as Nickless' fine solution -- but easier to wrap your head around 🙂

```
FWIW,
John

```

---

<div class="post-metadata">

### Author: ![Cryptonium](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/96bed5/32.png) [@Cryptonium](https://community.mp3tag.de/u/Cryptonium)
#### Post date: [September 28, 2005, 7:44pm UTC](https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279/5 "2005-09-28T19:44:21Z")

</div>

Another way to do this if you already format your track numbers with the totals is to use the **$validate** function.

Basically it allows you to replace characters not allowed in file names with another string.

For example, if you use:

```
$validate(%artist% - %track% , of )

```

It will convert the "/" in the track number to " of " which I believe is the result you wanted.

---

<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:19pm UTC](https://community.mp3tag.de/t/how-to-easily-rename-file-with-track-total/2279/6 "2026-02-09T12:19:27Z")

</div>


