Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: BradC on August 24, 2007, 08:48:41 pm

Title: Need help renaming image files
Post by: BradC on August 24, 2007, 08:48:41 pm
So I've been having a devil of a time getting NES roms and screenshots/titles/box scans with the same filename. First I had the Screenshot Archive image files, but my roms were named differently. Then I found the No-Intro romset, but the images were named incorrectly. I found a set of images, but they are still named slightly differently.

For example, the rom will be named:
Battle of Olympus, The (USA).zip

and the image will be named:
Battle of Olympus, The (U).jpg

They all have that where the rom is named with (USA) and the image is named with (U). I am trying to figure out a way to rename all of the images to match the roms, but I don't know how to do it. Does anyone know enough php or javascript or something, that they could help me write something to do this?

Basically what it would do is this:
1.) Read each file in the 'images' directory.
2.) Get the filename, and search for the string "(U)" or "(J)" or "(E)"
3.) Rename the file (or copy it to a new location with the new name) with "(USA)" or "(Japan)" or "(Europe)"

That would give me the results I need. Anyone have a clue how to do this?
Title: Re: Need help renaming image files
Post by: SGT on August 24, 2007, 09:19:35 pm
Well if the (U) or (J) or (E) is always at the end of the file name (not including the extension) like in your example, you could create a batch file:

Code: [Select]
ren *(U).jpg *(USA).jpg
ren *(E).jpg *(Europe).jpg
ren *(J).jpg *(Japan).jpg

Please test this extensively in a different folder with some test files as I don't want to be responsible for fouling up your file names.  Again this will NOT work if there is something after the (U) that shouldn't change.  For example, if you have a file:
Quote
South (U) Africa.jpg will become
South (USA).jpg



Title: Re: Need help renaming image files
Post by: BradC on August 24, 2007, 09:55:50 pm
Thanks, I didn't even think of that. Most of the files are like that, but I think some have other text after the (U). I could pull out those ones, or I could just rename the roms with similar logic to remove everything after the (USA).

Thanks, I'll give it a try and I should be able to come up with something that works.
Title: Re: Need help renaming image files
Post by: Circo on August 24, 2007, 09:59:38 pm
Just so you know I am posting up correctly named artwork packs over at emumovies.com  I am also making sure that they are as complete as possible.  New packs are posted every few days.  I started with the screenshot archive packs or other sites and then hunted down all of the missing ones (ebay is great for this)  then renamed to no-intro when possible or goodxxxx.  They will eventually be posted on the collections pages but for now you will find direct downloads in the news section.  All sets are US only.
Title: Re: Need help renaming image files
Post by: BradC on August 25, 2007, 12:51:14 pm
A friend of mine recommended this and it worked great:

Rename Master (http://www.joejoesoft.com/vcms/108/) It lets you rename part of the files by replacing them with something else. It worked awesome for what I needed and is a very handy little tool.