# Replace path when exporting m3u

**URL:** https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658
**Category:** Export
**Created:** [November 23, 2018, 10:24pm UTC](https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658 "2018-11-23T22:24:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Etz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/etz/32/7648_2.png) [@Etz](https://community.mp3tag.de/u/Etz)
#### Post date: [November 23, 2018, 10:24pm UTC](https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658/1 "2018-11-23T22:24:45Z")

</div>

At the moment I'm using mp3tag to export playlists with following:

```
$filename(%_workingdir%.m3u,utf-8)#EXTM3U
$loop(%_directory%)$loop(%_filename_ext%)%_path%
$loopend()$loopend()

```

Trick is that for fileserver I would like to replace path during Export, so basically:  
`\\Server\music\Albums\Something\Something\Somefile.mp3` would become `../Albums/Something/Something/Somefile.mp3` during export.

Any ideas how to do it with the least effort?

---

<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: [November 24, 2018, 8:24am UTC](https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658/2 "2018-11-24T08:24:33Z")

</div>

Instead of using `%_path%` directly, you do some replacements in the form of:

`$replace(%_path%,'\\Server\music','..','\','/')`

---

<div class="post-metadata">

### Author: ![Etz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/etz/32/7648_2.png) [@Etz](https://community.mp3tag.de/u/Etz)
#### Post date: [November 24, 2018, 9:04am UTC](https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658/3 "2018-11-24T09:04:20Z")

</div>

Looks good, any Ideas how to actually avoid, hardcoding `\\Server\` part?

..\music.. is always static anyways.

---

<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: [November 24, 2018, 9:18am UTC](https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658/4 "2018-11-24T09:18:17Z")

</div>

It depends a little on where you you store your playlists. It looks like they are on

`\\Server\music\Playlists\`

so you could try

`$replace(%_filename_rel%,'\','/')`

---

<div class="post-metadata">

### Author: ![Etz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/etz/32/7648_2.png) [@Etz](https://community.mp3tag.de/u/Etz)
#### Post date: [November 24, 2018, 9:28am UTC](https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658/5 "2018-11-24T09:28:17Z")

</div>

How did you find that out? 😃

But yes, indeed they are stored in `\\Server\music\playlists\` later

---

<div class="post-metadata">

### Author: ![Etz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/etz/32/7648_2.png) [@Etz](https://community.mp3tag.de/u/Etz)
#### Post date: [November 24, 2018, 4:13pm UTC](https://community.mp3tag.de/t/replace-path-when-exporting-m3u/43658/7 "2018-11-24T16:13:15Z")

</div>

Thank you @Florian, settled with:

```
$filename(\\Server\music\playlists\%_workingdir%.m3u,utf-8)#EXTM3U
$loop(%_directory%)$loop(%_filename_ext%)$replace(%_filename_rel%,'\','/')
$loopend()$loopend()
```
