# Create m3u files from multiple folders

**URL:** https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458
**Category:** General Discussion
**Created:** [October 20, 2017, 9:49pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458 "2017-10-20T21:49:58Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Edyedu](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/ed655f/32.png) [@Edyedu](https://community.mp3tag.de/u/Edyedu)
#### Post date: [October 20, 2017, 9:49pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/1 "2017-10-20T21:49:58Z")

</div>

Hello everyone.

I am very surprised of the great quality of the Mp3tag program.

I have been looking for a program that allows me to create M3U files of folders with a complete Albun. I would like to be able to create M3U files automatically for each folder in my music library.

I do not want to generate the M3U as an albun that has checked the Mp3tag program, I want the Mp3tag to scan the folders in my library and make an M3U file of the MP3s in that folder and continue to the next one.

Is this possible? Thank you!

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [October 21, 2017, 6:31am UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/2 "2017-10-21T06:31:14Z")

</div>

> [@Edyedu](#):
>
> ... I would like to be able to create M3U files automatically for each folder in my music library. ... I want the Mp3tag to scan the folders in my library and make an M3U file of the MP3s in that folder and continue to the next one. Is this possible? Thank you!

This proposal should work ...  
[Playlisten mal so mal so? Export-Alternative: Helft ihr mir beim Code?](https://community.mp3tag.de/t/14307/3)

1. Create a Mp3tag export script text file, name it as you wish, ... having the following text content ...

**$filename(%\_folderpath%$replace(%ALBUM%' - '%ARTIST%,';',' -',':',' -')'.m3u',ansi)$loop(%\_filename\_ext%)%\_filename\_ext% $loopend()**
1. Load all folders and files into the Mp3tag list view ... and select all the files, which should be treated.  
(Note: while testing the script do it for one folder only.)

2. Execute the menu function "Export" [Ctrl+E] and apply the export script from step 1.  
(Note: Activate the option " one file per directory")

3. Look into the target folder and check for the existance of the newly created m3u file.

If all looks ok, then do it for all selected files at once.

DD.20171021.1035.CEST

---

<div class="post-metadata">

### Author: ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)
#### Post date: [October 21, 2017, 4:29pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/3 "2017-10-21T16:29:27Z")

</div>

^  
Thank you DetlevD, this m3u-script is spot-on.

---

<div class="post-metadata">

### Author: ![GeoApo](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/g/a8b319/32.png) [@GeoApo](https://community.mp3tag.de/u/GeoApo)
#### Post date: [January 1, 2020, 4:33pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/4 "2020-01-01T16:33:16Z")

</div>

First of all thank you so much for helping the community! I have a slight problem here with the created .m3u playlists that I found a solution for but don't have the knowledge to apply it on the script text file.  
Here's the issue, the script adds all selected songs in a single row and Foobar can't read the songs.  
When I edit the m3u with Notepad and just place the songs one under the other it works!

 ![Screenshot_1](https://community.mp3tag.de/uploads/default/original/2X/2/221c491b574b6fed3a6f985390d80762815dd724.jpeg) ![Screenshot_2](https://community.mp3tag.de/uploads/default/original/2X/e/e51b4711b88a2c04be4e96ed38a62d25688d67ca.jpeg)

Do you have a workaround for this?

---

<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: [January 1, 2020, 4:40pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/5 "2020-01-01T16:40:35Z")

</div>

Unfortunately, you do not show us the export script that produces this result.  
But: I think it would be easiest, if you add an extra line in the export script right before the $loopend() statement.

---

<div class="post-metadata">

### Author: ![GeoApo](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/g/a8b319/32.png) [@GeoApo](https://community.mp3tag.de/u/GeoApo)
#### Post date: [January 1, 2020, 4:55pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/6 "2020-01-01T16:55:09Z")

</div>

Here it is

 ![Screenshot_4](https://community.mp3tag.de/uploads/default/original/2X/8/81a178d3af1fc480a540f034872839048bb6a5a0.jpeg)

Adding a simple extra line did indeed fix it! Thanks a ton mate!!!

---

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [June 16, 2024, 1:00am UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/8 "2024-06-16T01:00:28Z")

</div>

Hi All

The export script from above (with a small modification) successfully creates playlists in each of the subdirectories in the selected folder.

```auto
$filename(%_folderpath%$replace(PlayMe,';',' -',':',' -')'.m3u',ansi)$loop(%_filename_ext%)%_filename_ext%
$loopend()

```

My question is can it be amended to export _ **randomized** _ playlists to each subdirectory within the folder?

I have tried randomizing the order in the interface and then running the script but it just puts them back in the standard order in the playlists when it generates them. Perhaps an amendment to the script to reflect the randomized order showing in the interface would do the trick.

... or could it be done some other way?

Grateful for any advice.

🙂

---

<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: [June 16, 2024, 5:37am UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/9 "2024-06-16T05:37:11Z")

</div>

Instead of

> [@DetlevD](#):
>
> $loop(%\_filename\_ext%)

use  
`$loop(1)`  
this keeps the selected order from the filelist.  
Also have a look at the playlist generator

> **[Playlists – Mp3tag Documentation](https://docs.mp3tag.de/playlists/#generating-multiple-playlists)**
>
> Documentation on loading, managing, and saving Playlists. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [June 16, 2024, 3:08pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/10 "2024-06-16T15:08:23Z")

</div>

Thanks for your help. I made the amendment you suggested and this is working perfectly.

🙂

---

<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: [July 16, 2024, 3:08pm UTC](https://community.mp3tag.de/t/create-m3u-files-from-multiple-folders/19458/11 "2024-07-16T15:08:30Z")

</div>

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