ROM File Cleanup – Powershell – GoodMerge – NoIntro

ROM File Cleanup

You just downloaded a massive ROM pack for emulation, could be NES, SNES, N64, Genesis, etc… In the pack you would expect the ~600 games that actually came out in stores. Instead you find 15,000 games containing every version and prototype cartridge imaginable from every corner of the world.

Powershell can be the cure for this complete mess, by simply purging out the files matching filters. Code is below. Star (*) is a wildcard character. Just define the source and destination at the beginning.

This script assumes you want United States compatible releases. Note that some games were only released as (EU) [Europe + United States], or (JU) [Japan + United Sates]. This script includes these titles. If you find a pattern or format you do not like, feel free to add your own filter in to the list. If you are from Europe, you would want the (E)  or (EU) releases. (W) is a World-Wide Release.

This script is not perfect — it cannot catch everything because collectors often use custom naming conventions, but this code very easy to work with. After you are done, I recommend scrolling through your list and checking for any duplicate games.

There are two scripts:

  1. The first script creates a a copy of your files to a folder where you can process them all.
  2. The other script actually purges out the unwanted games with the Remove-Item command — a permanent delete command (no Recycle Bin)

ROM File Copy / Move Code

#File Copy or Move Code.
#Delete the comment (#) for Move-Item if you want to use that instead, and then comment out #Copy-Item
#Edit your source path (Original copy of unzipped ROMs) and destination path (Working area for ROMs).
$source = "C:\Installers\GenesisSource"
$destination = "C:\Installers\GenesisDestination"

cd $source
#Use if you want to work on your copy
#The symbol [!] means verified working, usable ROM.
Copy-Item *[!]* $destination

#Uncomment if you want to move -- This is a cut/paste, these files will not be coming back.
#Move-Item *[!]* $destination

 ROM File Cleanup Code

#Dan Kruse - itimagination.com - December 2nd 2016
#To run this command, you can either copy/paste in all of the code, or more easily, save it into a TEXT file in the format .ps1.
#Then open Powershell.exe in Windows and run the filename of the script. For example:
#Powershell.exe
#C:\Installers\CleanupRoms.ps1

#The hash-symbol(# will deactivate a line of code. Useful for pausing the copy/pasting of the script on the row beginning with "Copy-Item"

#Remove by Country Initials
get-childitem -Recurse -path "$destination" -filter '*(B)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Bra]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(CCE)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(CH)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Chi]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(E)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(F)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(G)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(J)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(JE)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(K)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(R)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(PAL)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(PD)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(SECAM)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(UA)*' | remove-item

#Remove by Country Name
get-childitem -Recurse -path "$destination" -filter '*Canada*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*China*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(Europe)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*France*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Germany*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Italy*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Japan*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Sachen*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Spain*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(Unknown)*' | remove-item

#Remove by Keyword
get-childitem -Recurse -path "$destination" -filter '*AKA*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*(Alpha)*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Beta*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*canal*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*demo*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*hack*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*preview*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Proto*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Rev A*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Rev02*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Rev03*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Rev04*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*Screen Search*' | remove-item

#Remove by Invalid ROM Type
get-childitem -Recurse -path "$destination" -filter '*[a*]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[b*]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[f*]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[fixed]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[h*C]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[hI*]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[o*]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[p*]*' | remove-item
get-childitem -Recurse -path "$destination" -filter '*[p1]*' | remove-item

 

Leave a Reply

Your email address will not be published. Required fields are marked *