Batch file for sorting Roms


b1ueskycomp1ex

Open Sauce Fanatic & AMD Fanboy
Joined
May 19, 2009
Messages
721
Website
https
I've created a little batch file for use with a large lump of roms you might have. It'll try it's best at sorting them into proper folders. It sorts into U, E, and J folders, with any other codes being tossed into an OTHER folders. The alternates, bad dumps, etc. End up in a Junk folder inside of the U, E, or J folders. Any hacks, translations, unlicensed, or public domain roms get dropped into their own folders. Copy and paste the following code into a text file and rename it RomSort.bat Then drop it into a folder containing ONE SYSTEM'S ROMS. This has been tested in NES roms, and no other types of roms or sets of roms. It's also not recursive. I plan on writing some more to recursively grab all your different types of roms for different systems and sort them all according to system, etc. But for now, it's this:

Code:
echo ON

echo just so you know, this isn't complete.  It might not work for all

echo rom sets or systems, but has been tested to work with GoodNES Rom 

echo sets.

echo

echo Starting Rom Sort, Creating sub directories

echo


REM - Yeah, no logic here, just a stupid script.


echo Making Folders...


mkdir .\Roms\U

mkdir .\Roms\J

mkdir .\Roms\E

mkdir .\Roms\Other_Codes

mkdir .\Roms\Oddities

mkdir .\Roms\Oddities\Hacks

mkdir .\Roms\Oddities\Public_Domain

mkdir .\Roms\Oddities\Unlicensed

mkdir .\Roms\Oddities\Translated


echo Done making folders, Now we're sorting the odd bunch...


move .\*[T+*.* .\Roms\Oddities\Translated

move .\*(hack*.* .\Roms\Oddities\Hacks

move .\*hack)*.* .\Roms\Oddities\Hacks

move .\*[h]*.* .\Roms\Oddities\Hacks

move .\*(unl)*.* .\Roms\Oddities\Unlicensed

move .\*(PD)*.* .\Roms\Oddities\Public_Domain


echo Done sorting the odd bunch, now we're sorting the normal files...


move .\*(u)*.* .\Roms\U

move .\*(e)*.* .\Roms\E

move .\*(j)*.* .\Roms\J

move .\*(*)*.* .\Roms\Other_Codes


echo Great, now we're organizing the normal files...

echo basically this just takes the trained files,

echo overdumps, alternates, bad dumps, etc.

echo and throws them into .\Junk in their respective

echo Coded folders.


cd .\Roms\U

mkdir .\Junk

move .\*[t*]*.* .\Junk

move .\*[a*]*.* .\Junk

move .\*[b*]*.* .\Junk

move .\*[a]*.* .\Junk

move .\*[b]*.* .\Junk

move .\*[t]*.* .\Junk

move .\*[o*]*.* .\Junk

move .\*[o]*.* .\Junk

move .\*[x]*.* .\Junk

move .\*[p*]*.* .\Junk

move .\*[p]*.* .\Junk

cd ..


cd .\Roms\E

mkdir .\Junk

move .\*[t*]*.* .\Junk

move .\*[a*]*.* .\Junk

move .\*[b*]*.* .\Junk

move .\*[a]*.* .\Junk

move .\*[b]*.* .\Junk

move .\*[t]*.* .\Junk

move .\*[o*]*.* .\Junk

move .\*[o]*.* .\Junk

move .\*[x]*.* .\Junk

move .\*[p*]*.* .\Junk

move .\*[p]*.* .\Junk

cd..


cd .\Roms\J

mkdir .\Junk

move .\*[t*]*.* .\Junk

move .\*[a*]*.* .\Junk

move .\*[b*]*.* .\Junk

move .\*[a]*.* .\Junk

move .\*[b]*.* .\Junk

move .\*[t]*.* .\Junk

move .\*[o*]*.* .\Junk

move .\*[o]*.* .\Junk

move .\*[x]*.* .\Junk

move .\*[p*]*.* .\Junk

move .\*[p]*.* .\Junk

cd..

cd..


dir .\Roms\ /A:-D /B /S > .\Result.txt


move .\*.txt .\Roms\

move .\*.bat .\Roms\


mkdir .\Roms\Junk

move .\*.* .\Roms\Junk
 
that's a nice script man, any chance you can write something for those that don't collect the sets that archive all the junk? i collect the no-intro sets that only archive the best known version for every region... but this presents a new problem in that you end up with region dupes. how would one write a script that did the following:


removes anything that isn't USA or EUR.


removes all EUR except where the USA version doesn't exist.
 
It took me a while to understand why you're escaping everything. It seems I haven't used windows in a while :D


EDIT: Actually, it was the "dir" command that finally made me realize that it's not a bash script. Somehow I just skimmed the rest.
 
Last edited by a moderator:
^ I think the .bat is a giveaway too.


Anybody feel like rewriting this for a 'normal' shell? :p


[edit: maybe wait until it's more mature ;) ]
 
A quick note that I'll be writing a script to do this sort of thing. It should take no time at all, but I need to get organized so I can actually do development.


(in fact, I paused this reply and wrote up the skeleton already)
 
Back
Top