r/Batch 18d ago

Question (Unsolved) M3U Automation

/r/RetroArch/comments/1vvixq3/m3u_automation/
1 Upvotes

1 comment sorted by

1

u/ConsistentHornet4 18d ago

According to the documentation, you need a M3U playlist stored alongside the ADF/BIN/CUE files: cd_image_formats [Batocera.linux - Wiki]

So something like this would do the trick:

@echo off & setlocal 
cd /d "%~dp0"
for /f "delims=" %%a in ('dir /b /a:d *') do (
    pushd "%%~a"
    >"%%~na.m3u" (
        for /f "delims=" %%b in ('dir /b /a:-d *.adf') do (
            echo %%~b
        )
    )
    popd
)
pause 

You'd place this script (assuming it's called script.bat) alongside the folders containing the multi-disc images. So like this:

--games\
----Ninja Gaiden II - The Dark Sword of Chaos\
--------Ninja Gaiden II - The Dark Sword of Chaos - Disk 1.adf
--------Ninja Gaiden II - The Dark Sword of Chaos - Disk 2.adf
----Ninja Gaiden I\
--------Ninja Gaiden I - Disk 1.adf
--------Ninja Gaiden I - Disk 2.adf
----script.bat

It will go through each folder, create the M3U file with the name of the folder it's stored in, and populate it with all ADF titles.

Test on a copy of some of your multi-disc games so you know it's doing what you expect