# Looking for help with a filename expression

**URL:** <https://community.mp3tag.de/t/looking-for-help-with-a-filename-expression/19229>\
**Category:** Support\
**Created:** [August 16, 2017, 2:31am UTC](https://community.mp3tag.de/t/looking-for-help-with-a-filename-expression/19229 "2017-08-16T02:31:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Demonasius](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Demonasius](https://community.mp3tag.de/u/Demonasius)\
**Post date:** [August 16, 2017, 2:31am UTC](https://community.mp3tag.de/t/looking-for-help-with-a-filename-expression/19229/1 "2017-08-16T02:31:42Z")

</div>

Hello all,

Just need some quick help. I'm looking for assistance on making a Tag-Filename expression that turns forward slashes "/" or Backslashes "" into hyphens "-" and if possible remove any leading or trailing spaces from filenames as well.

So say a file with a title like this.

blah/blah/blah

to

01.blah - blah - blah.mp3

This is my normal file rename string  
%track%.%title%

Not a huge deal on the leading/trailing spaces but a replacer for the slashes would be great. I appreciate any and all assistance.

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [August 16, 2017, 3:00am UTC](https://community.mp3tag.de/t/looking-for-help-with-a-filename-expression/19229/2 "2017-08-16T03:00:58Z")

</div>

Convert-menue Tag - Filename:

$trim(%track%).$trim($replace(%title%,/, - ,, - ))

I think you dont only want to get rid of leading or trailing spaces of the filename but of the patts of the filename too.  
So the trim() is needed 2 times: for the track and for the title.

Instead of this I recommend to delete the leading/trailing spaces already in the tags and not in the 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:** [August 16, 2017, 3:01am UTC](https://community.mp3tag.de/t/looking-for-help-with-a-filename-expression/19229/3 "2017-08-16T03:01:53Z")

</div>

> [@Demonasius](#):
>
> Hello all,...  
> blah/blah/blah
> 
> to
> 
> 01.blah - blah - blah.mp3

Try as format string:  
$num(%track%,2).$validate($trim($replace(%title%,/, - )), )

(... beaten by poster ...)

---

<div class="post-metadata">

**Author:** ![Demonasius](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Demonasius](https://community.mp3tag.de/u/Demonasius)\
**Post date:** [August 16, 2017, 3:22am UTC](https://community.mp3tag.de/t/looking-for-help-with-a-filename-expression/19229/4 "2017-08-16T03:22:58Z")

</div>

> [@ohrenkino](#):
>
> Try as format string:  
> $num(%track%,2).$validate($trim($replace(%title%,/, - )), )
> 
> (... beaten by poster ...)

That worked perfectly, thank you.

---

<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:26pm UTC](https://community.mp3tag.de/t/looking-for-help-with-a-filename-expression/19229/5 "2026-02-09T12:26:56Z")

</div>


