Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: jimmer on July 05, 2014, 05:39:23 am

Title: Need file processing tool or help with DOS batch command
Post by: jimmer on July 05, 2014, 05:39:23 am

Can someone write me a batch file to do this please?

I've got a folder with 30000 snap images.
And I've got a text list of 3000 games I'm (at least possibly) interested in.
I want to copy the matching 3000 snaps to a new folder.


Or point me to existing tools,

or point me to a collection of snaps that doesn't include all the dross.

TVM

Title: Re: Need file processing tool or help with DOS batch command
Post by: adder on July 05, 2014, 06:02:37 am

i use a free program called textcrawler to do this sort of thing

i can create the batch file you require but you will need to attach/send me the 3000 games list

ps. are you using windows xp?
Title: Re: Need file processing tool or help with DOS batch command
Post by: jimmer on July 05, 2014, 06:10:43 am

thanks, I'll have a look at textcrawler.

Here is an example txt file.  I might want to do this again, but keen to see what you provide.

This will be run in windows7    (build my mame setups on win7and run them on winXP)
Title: Re: Need file processing tool or help with DOS batch command
Post by: adder on July 05, 2014, 06:33:40 am
ok i will give this a go now
quick question though as i dont use snap images, are they all in .png format?
Title: Re: Need file processing tool or help with DOS batch command
Post by: headkaze on July 05, 2014, 06:38:02 am
Quite easy to do in C#. You can get yourself a copy of Visual Studio Express and write a simple program to do this.

Eg.
Code: [Select]
private void Form1_Load(object sender, EventArgs e)
{
string[] lineArray = File.ReadAllLines(Path.Combine(Application.StartupPath, "mame_d248_5474_games.txt"));

foreach (string lineString in lineArray)
{
string fileName = String.Format("{0}.png", lineString);
string sourcePath = Path.Combine(@"C:\MySourceFolder", fileName);
string destPath = Path.Combine(@"C:\MyDestFolder", fileName);

if(File.Exists(sourcePath))
File.Copy(sourcePath, destPath, true);
}
}
Title: Re: Need file processing tool or help with DOS batch command
Post by: adder on July 05, 2014, 06:49:49 am
here you go assuming you are using .png images
i used textcrawler to do it, once you are used to it its quick and easy
note: make a folder called 'copied' in your main folder of .png snap images, before running the batch file in your main folder of .png snap images
batch file is attached in the .zip:
Title: Re: Need file processing tool or help with DOS batch command
Post by: jimmer on July 05, 2014, 09:42:05 am
Thanks for both of those.

jadder: not elegant!  but it's the sort of thing I used to do (I'd use unix parsing commands to change a list into a list of actions). I've got textcrawler now, might come in useful.

headkaze: That what I was hoping for but as .bat     I might look into VSE but I don't know C, so probably won't at this time.


I'll admit I ended up reverting to my trusty old excel macros to do the job.
(change ext to .xlsm) if you want to use it.
Title: Re: Need file processing tool or help with DOS batch command
Post by: headkaze on July 05, 2014, 11:01:44 am
It's a shame Jimmer.. I was trying to teach you how to fish ;)

PS: I could write you a DOS batch file to do the same. I just think you're better off learning C#
Title: Re: Need file processing tool or help with DOS batch command
Post by: jimmer on July 05, 2014, 12:45:07 pm

thanks headkaze, but I don't have time right now :) 

I got started on python a coupe of years ago but once I'd done what I needed it for,  it's nearly all forgotten now. I should probably have dug that out for this task.
Title: Re: Need file processing tool or help with DOS batch command
Post by: spoot on July 05, 2014, 02:37:20 pm

thanks headkaze, but I don't have time right now :) 

I got started on python a coupe of years ago but once I'd done what I needed it for,  it's nearly all forgotten now. I should probably have dug that out for this task.

I was gunna say.......it'd be a very short python program.  :)

Open file and read by line
try
  copy file by name in line
except (if not there, who cares)
  pass
close file
Title: Re: Need file processing tool or help with DOS batch command
Post by: jimmer on July 06, 2014, 06:12:44 am

And finally;

My example list came from ROMlister. Which, I've just spotted, also has the option of outputting a batch file!
Title: Re: Need file processing tool or help with DOS batch command
Post by: NOP on July 06, 2014, 10:33:49 am
yep, that would have done the trick nicely...

copy %ROM%.png c:\mame\snaps

http://wiki.arcadecontrols.com/wiki/RL_tutorial_batchFiles (http://wiki.arcadecontrols.com/wiki/RL_tutorial_batchFiles)

Sorry you got there a bit too late- you already had the tool in your toolbox.