Copying all roms from a gamelist into a new folder?

Emu Talk Goes Here
Post Reply
User avatar
GagaMan
128-bit
Posts: 750
Joined: Wed Jun 13, 2007 10:36 am

Copying all roms from a gamelist into a new folder?

Post by GagaMan »

I have a ROM folder of about 3000 games for the PC version of MAME and I want to copy and paste all the roms from it that work with the GP2X 1.6 version of MAME4all according to the gamelist. Is this possible without going through all the names in the gamelist individually? Thanks.
Hatta
Next-Gen
Posts: 4030
Joined: Tue May 06, 2008 8:33 pm

Re: Copying all roms from a gamelist into a new folder?

Post by Hatta »

Assuming you have a text file with the name of each game in it, I'd use a simple shell script. Something like:

$mkdir gp2xcompat; for each in `cat gp2xcompat.txt`; do cp $each.zip ./gp2xcompat; done

If you use windows, you can install cygwin to get bash, or just use this.
We are prepared to live in the plain and die in the plain!
Hatta
Next-Gen
Posts: 4030
Joined: Tue May 06, 2008 8:33 pm

Re: Copying all roms from a gamelist into a new folder?

Post by Hatta »

Oh yeah, it's worth pointing out that MAME roms may change from version to version. If your PC MAME romset is current, and MAME4all forked a while ago, you may have trouble using the newer roms with the older emulator. But I haven't used MAME4all so I don't know for sure. I have run into this problem on MAMEoX.
We are prepared to live in the plain and die in the plain!
User avatar
elvis
128-bit
Posts: 910
Joined: Sun Oct 05, 2008 1:20 am
Location: Brisbane, Queensland, Australia
Contact:

Re: Copying all roms from a gamelist into a new folder?

Post by elvis »

Linux user/lover here (BASH for life), but for the sake of those stuck in Windows land:

Generate yourself a plain text file with the files you want, one per line (however that works - export from an application, copied from a website, whatever). Assuming:

1) Your text file is called "gamelist.txt"
2) Your gamelist.txt has ROM names without the ".zip" extension
3) Your roms live in c:\roms
4) You want to copy the working ROMs to c:\selection

Your win32 command looks like:
for /f "delims=," %I IN (gamelist.txt) DO copy "c:\roms\%I.zip" c:\selection

Obviously chop and change the bits you need to suit your cause. The above will split variables on either newline or on a comma (defined by the "delims"). Again, change to suit your needs.

Also it's worth noting that in Windows2000, the variable is defined as "%%I". In WinXP it switched to "%I". I wouldn't have a clue what's appropriate for Vista or Win7, as I've stayed well away from both (that company turned to shit since Ballmer started running things).
User avatar
GagaMan
128-bit
Posts: 750
Joined: Wed Jun 13, 2007 10:36 am

Re: Copying all roms from a gamelist into a new folder?

Post by GagaMan »

Thanks Elvis, that works though I need to delete all the "game title" bits from the gamelist to make it work for everything.
User avatar
elvis
128-bit
Posts: 910
Joined: Sun Oct 05, 2008 1:20 am
Location: Brisbane, Queensland, Australia
Contact:

Re: Copying all roms from a gamelist into a new folder?

Post by elvis »

"Find and replace" in notepad/wordpad/textpad is your friend. :)

(I much prefer "sed", but whatever...)
User avatar
GagaMan
128-bit
Posts: 750
Joined: Wed Jun 13, 2007 10:36 am

Re: Copying all roms from a gamelist into a new folder?

Post by GagaMan »

Is it possible to replace every character after the 8th on each line? The ROM files are a max of 8 characters each so that way I could get ri of the lot. That or any word beginning with a capital letter. :)
User avatar
MrPopo
Moderator
Posts: 24190
Joined: Tue Aug 26, 2008 1:01 pm
Location: Orange County, CA

Re: Copying all roms from a gamelist into a new folder?

Post by MrPopo »

If you want to get fancy then download perl for windows and do some regex parsing.
Blizzard Entertainment Software Developer - All comments and views are my own and not representative of the company.
User avatar
elvis
128-bit
Posts: 910
Joined: Sun Oct 05, 2008 1:20 am
Location: Brisbane, Queensland, Australia
Contact:

Re: Copying all roms from a gamelist into a new folder?

Post by elvis »

GagaMan wrote:Is it possible to replace every character after the 8th on each line? The ROM files are a max of 8 characters each so that way I could get ri of the lot. That or any word beginning with a capital letter. :)
As mentioned, perl and sed will do these sorts of things for you.

What you need to do is learn regex (Regular Expressions). This is a powerful "language" of sorts that lets you build complex patterns to match (and if you wish, replace) text.

Google "sed regex examples" to get yourself started. If you're a windows user, you can get sed (as well as bash, perl, awk, sort, uniq, and a host of other very cool command-line text-processing tools) via Cygwin:
http://www.cygwin.com/
Post Reply