Batch file to create a m3u playlist for every folder

330 Views Asked by At

I have this situation in my music folder:

Music

Pop (song nr 1.mp3, song nr 2.mp3)

Rock song nr 3.mp3)

I would like to create inside the main folder "music" one .m3u file with the name of each folder in order to have Pop.m3u, Rock.m3u and so on... Each file should contain the relative path of the song, i.e: Pop.m3u contains:

/Music/Pop/song nr 1.mp3
/Music/Pop/song nr 2.mp3

I managed with some copy paste to create batch file like this one

@echo off for /R "%~dp0" %%I in (*.mp3) do for %%J in ("%%~dpI.") do echo %%~nxI>>"%%~dpI%%~nxJ.m3u"

the problem is: the file are stored inside the folders (which is not a big deal, because i can move them outside), but the main problem is that files are saved just like

song 1.mp3
song 2.mp3

and not

/music/pop/song 1.mp3

i tried also:

@echo off 
for /d %%A in (*) do @if exist "%%~A*.dsk" (
for %%B in ("%%~A*.dsk") do @echo %%~A%%~nxB
) > "%%~fA%%~nxA.m3u"

but it did not work at all

Do you have any tip for me? Thank you

0

There are 0 best solutions below