Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Need help renaming image files  (Read 1253 times)

0 Members and 1 Guest are viewing this topic.

BradC

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 182
  • Last login:December 22, 2010, 05:56:28 pm
    • My First Arcade Cabinet
Need help renaming image files
« 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?

SGT

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1146
  • Last login:May 31, 2025, 10:10:32 pm
Re: Need help renaming image files
« Reply #1 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




BradC

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 182
  • Last login:December 22, 2010, 05:56:28 pm
    • My First Arcade Cabinet
Re: Need help renaming image files
« Reply #2 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.

Circo

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 849
  • Last login:May 11, 2020, 03:27:51 am
  • Still using screenshots? Try EmuMovies instead.
    • EmuMovies
Re: Need help renaming image files
« Reply #3 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.
My Websites

BradC

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 182
  • Last login:December 22, 2010, 05:56:28 pm
    • My First Arcade Cabinet
Re: Need help renaming image files
« Reply #4 on: August 25, 2007, 12:51:14 pm »
A friend of mine recommended this and it worked great:

Rename Master 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.