# Dealing With Zeros in Filenames

**URL:** https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777
**Category:** Mac
**Created:** [February 26, 2026, 10:31pm UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777 "2026-02-26T22:31:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Aruchizan](https://community.mp3tag.de/user_avatar/community.mp3tag.de/aruchizan/32/22093_2.png) [@Aruchizan](https://community.mp3tag.de/u/Aruchizan)
#### Post date: [February 26, 2026, 10:31pm UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777/1 "2026-02-26T22:31:26Z")

</div>

I keep my audio file names with the following template:

[track number] [song title]

For example:

01 Everything in Its Right Place

The friction I’m running into is that my track numbers in the metadata do not include that initial 0 (and I don’t want them to). So if we take a look at my example, the song “Everything in Its Right Place” has a track number of “1”, not “01”. I want to be able to use MP3Tag to rename my files using the track number and title, but I want MP3Tag to add a 0 before the number to the file name when the track number is less than 10. (In other words, I don’t want to add a 0 before 10 so that it would say 010. I want my files to look like: 01 Song, 02 Song, …, 10 Song, 11 Song, etc.)

If I use the “Tag - Filename” action, I’m currently using “0%TRACK% %TITLE%”, and then going through the file names of songs that are track number 10 or more and manually removing the preceding “0” so “010” becomes “10”, “011” becomes “11”, and so on. I’m guessing there’s a better way. Can anyone help me? Thank you for your time!

---

<div class="post-metadata">

### Author: ![ms6676749](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/b4bc9f/32.png) [@ms6676749](https://community.mp3tag.de/u/ms6676749)
#### Post date: [February 27, 2026, 1:33am UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777/2 "2026-02-27T01:33:26Z")

</div>

M4A tag spec stores %track% as integers not strings like MP3/FLAC, so leading zeros are not possible if that’s the file you are working with.

> [@Leading zeros are not possible with automatic and manual track numbering](https://community.mp3tag.de/t/leading-zeros-are-not-possible-with-automatic-and-manual-track-numbering/66532/3):
>
> It's unfortunately not possible with the MP4/M4A format. Track numbers are stored as integer values there (basically a number) in the file instead of a numeric string (like "01") as with MP3 or FLAC. If you want to use leading zeros when renaming files, you can always use $num(%track%,2) instead of %track%

If you want to do tag → filename, you can try: `$iflonger(%track%,1,%track%,$num(%track%,2))`

Basically, if the %track% length is longer than 1 (e.g., two digits), then %track% will be used, if %track% is 1 digit, then a leading zero will be prepended to %track% in the filename.

---

<div class="post-metadata">

### Author: ![Aruchizan](https://community.mp3tag.de/user_avatar/community.mp3tag.de/aruchizan/32/22093_2.png) [@Aruchizan](https://community.mp3tag.de/u/Aruchizan)
#### Post date: [February 27, 2026, 1:40am UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777/3 "2026-02-27T01:40:31Z")

</div>

Ahh, that’s too bad. I’m on day one of use and MP3Tag is already proving to be invaluable in terms of batch editing both albums and my music library as a whole\*. I will be purchasing a license once my trial period runs out, assuming I don’t come across many more “I can’t do this” scenarios. I appreciate you taking the time out to respond, **[ms6676749](https://community.mp3tag.de/u/ms6676749).**

(\*It was so nice to be able to remove disc numbers, comments, composers, and genres from everything, instantly!)

---

<div class="post-metadata">

### Author: ![Aruchizan](https://community.mp3tag.de/user_avatar/community.mp3tag.de/aruchizan/32/22093_2.png) [@Aruchizan](https://community.mp3tag.de/u/Aruchizan)
#### Post date: [February 27, 2026, 1:46am UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777/4 "2026-02-27T01:46:03Z")

</div>

I just saw your edit after I posted my initial reply, I almost missed it, that worked! Thank you! 😃

---

<div class="post-metadata">

### Author: ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)
#### Post date: [February 27, 2026, 2:02am UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777/5 "2026-02-27T02:02:45Z")

</div>

> [@ms6676749](#):
>
> you want to do tag → filename, you can try: `$iflonger(%track%,1,%track%,$num(%track%,2))`

You can simply use $num(%track%,2) without the if statement. This function will make the track two-digits when updating filename.

However as mentioned earlier if the file type is m4a you cannot force the actual disc or track numbers to be two-digit.

---

<div class="post-metadata">

### Author: ![ms6676749](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/b4bc9f/32.png) [@ms6676749](https://community.mp3tag.de/u/ms6676749)
#### Post date: [February 27, 2026, 2:14am UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777/6 "2026-02-27T02:14:24Z")

</div>

True, I was going to leave it at just $num(%track%,2) because it means that filename track numbers will have 2-digits (leading zeroes if necessary) the very least. Just had a brainfart there.

---

<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: [March 6, 2026, 2:15am UTC](https://community.mp3tag.de/t/dealing-with-zeros-in-filenames/70777/7 "2026-03-06T02:15:16Z")

</div>

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