Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up --- Bug Reports --- Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news


Author Topic: easy way to remove roms if not in xml?  (Read 280 times)

0 Members and 1 Guest are viewing this topic.


  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 639
  • Last login:Today at 01:38:06 am
    • my baby
easy way to remove roms if not in xml?
« on: April 17, 2020, 04:17:48 pm »
hi guys,

i have a 209 set, 12k+ games listed and i have a curated xml that only has 3k games (only, sheesh).

the front end i am using is listing all games in my rom folder.  so, is there anyway to compare roms in the folder to an xml file and move missing roms or just delete them outright?



  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 313
  • Last login:Today at 02:37:50 am
    • Project Build
Re: easy way to remove roms if not in xml?
« Reply #1 on: May 12, 2020, 09:03:12 am »
Easy, not that I know of. no.

So I usually make a Powershell script to do that kind of thing.
But you should never have the script do anything, you should have it make a batchfile to do it, that way you can review it line by line before it applies anything to your files.

Code: [Select]
$inputfile = "./mame209.xml"
$outputfile = "./move-roms.bat"

if (Test-Path $outputfile){Remove-Item $outputfile}

$masterlist_list = New-Object System.Collections.ArrayList
foreach($list in Get-Content $inputfile)
$masterlist_list.Add($list) > $null
foreach($line in $masterlist_list)
if($line -like '*game name*'){
$lines = $line -split('\"')
$moveline = 'move ' + $lines[1] + '.zip d:\new-folder\'
write-host $moveline
Add-Content $outputfile $moveline
Read-Host -Prompt “Press Enter to exit”

The above .ps1 file will open your file (here named mame209.xml) and match every line of it against "*game name*" (this is at the beginning before each rom), and then it splits that matching line into pieces at the " symbol, it then takes the second piece after the " and adds the move commands around it (target here is the d:\new-folder\), then creates a .bat file with all the commands.
Review the newly created "move-roms.bat" and fix it as needed.
When run it moves the ones you want, and leaves the ones not in the list, but keep them around (see below).

It's pretty straightforward, just modify it as you need, or post your .xml (or a piece of it) and I can help you out.

Know that if you have your roms split, you will have to manually add the missing parents if your list has clones.
You can also script that, but I'd need to see the XML.
« Last Edit: May 12, 2020, 09:08:10 am by MacGyver »