# Absolute path formatting

**URL:** <https://community.mp3tag.de/t/absolute-path-formatting/50676>\
**Category:** Support\
**Created:** [November 2, 2020, 3:37am UTC](https://community.mp3tag.de/t/absolute-path-formatting/50676 "2020-11-02T03:37:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lem](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/74df32/32.png) [@Lem](https://community.mp3tag.de/u/Lem)\
**Post date:** [November 2, 2020, 3:37am UTC](https://community.mp3tag.de/t/absolute-path-formatting/50676/1 "2020-11-02T03:37:58Z")

</div>

I am using a script that I found in this forum to export to XSPF playlist format.

It works fine for relative paths, but for absolute paths when using MP3Tag's `%_path%` command it does not result in the correct format of path required by XSPF, so the playlist file does not work.

How can I change this kind of path:  
`T:\Temp\Sample Files\Audio Formats\out2.flac`

into this kind of path:  
`file:///T:/Temp/Sample%20Files/Audio%20Formats/out2.flac`

It probably needs regex (but I don't know how to use that).

---

<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:** [November 2, 2020, 6:05am UTC](https://community.mp3tag.de/t/absolute-path-formatting/50676/2 "2020-11-02T06:05:12Z")

</div>

> [@Lem](#):
>
> It probably needs regex

I think a simple replace is enough:  
`file:///$replace('T:\Temp\Sample Files\Audio Formats\out2.flac',\,/, ,'%20')`  
Put the text constant "file:///" in front and then the replace statement.

---

<div class="post-metadata">

**Author:** ![Lem](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/74df32/32.png) [@Lem](https://community.mp3tag.de/u/Lem)\
**Post date:** [November 2, 2020, 7:22am UTC](https://community.mp3tag.de/t/absolute-path-formatting/50676/3 "2020-11-02T07:22:49Z")

</div>

Thank you for your reply.

When you break it down like that, that the changes don't seem quite as complicated as I first thought (although I still would not have been able to figure out how to construct the correct 'replace' command).

The solution that you provided had me a bit confused at first because you included an actual path in your answer. But then I realised that it's just the output of %\_path%, so I substituted the path with the placeholder and it works!

`<location>$replace(file:///$replace(%_path%,\,/, ,'%20'),&,&amp;)</location>`

Thanks.

---

<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:** [November 2, 2020, 7:28am UTC](https://community.mp3tag.de/t/absolute-path-formatting/50676/4 "2020-11-02T07:28:50Z")

</div>

> [@Lem](#):
>
> $replace(file:///$replace(

I think that the part "`file:///`" is not really the most elegant way.  
`<location>file:///$replace(%_path%,\,/, ,'%20',&,&amp;)</location>`  
should be it

---

<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:** [December 2, 2020, 7:28am UTC](https://community.mp3tag.de/t/absolute-path-formatting/50676/5 "2020-12-02T07:28:55Z")

</div>

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