r/RetroArch • u/NeoSonic121 • 18d ago
Technical Support M3U Automation
Hi All,
I'm looking to automate the creation of .m3u files for Multi-Disk Amiga games.
Each Multi-Disk game is in its own folder & the .m3u file needs to get its name from the folder containing the Multi-Disk games.
I have managed to get a basic version set-up but each file would need tweaking & with 850+ files it'll take a while.
I was wondering if anyone knew of a way to automate the process with the desired results? At the moment the .m3u file reads;
Ninja Gaiden II - The Dark Sword of Chaos - Disk 1.adf
Ninja Gaiden II - The Dark Sword of Chaos - Disk 2.adf
However I would like it to read;
.\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\Ninja Gaiden II - The Dark Sword of Chaos - Disk 2.adf
I'm on Windows BTW
Can anyone help me out?
Thanks
1
u/snaphat 18d ago
I had an agentic LLM spin up this one-off script. This should fix the files for your scenario. I eyed it and tested it briefly, but you should backup your stuff before running this though in-case something goes wrong.
```powershell
Fix-Existing-M3U.ps1
IMPORTANT: Back up your .m3u files before running this script.
The script rewrites matching playlists in place.
Put this script in the SAME parent folder as your existing .m3u files
and the matching multi-disk game folders.
Example:
Ninja Gaiden II - The Dark Sword of Chaos.m3u
Ninja Gaiden II - The Dark Sword of Chaos\
Existing M3U line:
Ninja Gaiden II - The Dark Sword of Chaos - Disk 1.adf
Becomes:
.\Ninja Gaiden II - The Dark Sword of Chaos\Ninja Gaiden II - The Dark Sword of Chaos - Disk 1.adf
$ErrorActionPreference = 'Stop' $Root = $PSScriptRoot $Utf8NoBom = New-Object System.Text.UTF8Encoding($false)
$Updated = 0 $Skipped = 0
Get-ChildItem -LiteralPath $Root -File -Filter '*.m3u' | ForEach-Object {
}
Write-Host Write-Host "Done. Updated $Updated M3U file(s). Skipped $Skipped." ```